summaryrefslogtreecommitdiffstats
path: root/mdoc_state.c
Commit message (Collapse)AuthorAgeFilesLines
* Because mandoc_aux.h and mandoc.h use __attribute__, all files thatIngo Schwarze2020-06-221-1/+3
| | | | | | | | include mandoc_aux.h or mandoc.h need to include config.h, too. It is suspected that for example IRIX needs this, or it is likely to throw errors in these files because the system compiler doesn't understand __attribute__. Issue reported by Kazuo Kuroi <kazuo at irixnet dot org>.
* Introduce a new mdoc(7) macro .Tg ("tag") to explicitly mark a placeIngo Schwarze2020-01-191-0/+1
| | | | | | | | | | | | | | | as defining a term. Please only use it when automatic tagging does not work. Manual page authors will not be required to add the new macro; using it remains optional. HTML output is still rudimentary in this version and will be polished later. Thanks to kn@ for reminding me that i have been considering since BSDCan 2014 whether something like this might be useful. Given that possibilities of making automatic tagging better are running out and there are still several situations where automatic tagging cannot do the job, i think the time is now ripe. Feedback and no objection from millert@; OK espie@ inoguchi@ kn@.
* Correctly set the ROFF_NOFILL parser flag for .Bd .Ed .Sh, suchIngo Schwarze2019-01-011-39/+2
| | | | | | that children and later siblings get correct NODE_NOFILL assignments. This doesn't change rendering yet but prepares for future rendering improvements.
* Cleanup, no functional change:Ingo Schwarze2018-12-311-2/+2
| | | | | | Use the new parser flag ROFF_NOFILL in the mdoc(7) parser, too, instead of the old MDOC_LITERAL, which was an alias for the former MAN_LITERAL.
* Cleanup, minus 15 LOC, no functional change:Ingo Schwarze2018-12-311-8/+0
| | | | | | | | | Simplify the way the man(7) and mdoc(7) validators are called. Reset the parser state with a common function before calling them. There is no need to again reset the parser state afterwards, the parsers are no longer used after validation. This allows getting rid of man_node_validate() and mdoc_node_validate() as separate functions.
* Cleanup, no functional change:Ingo Schwarze2018-12-301-0/+1
| | | | | | | | | | | | | | The struct roff_man used to be a bad mixture of internal parser state and public parsing results. Move the public results to the parsing result struct roff_meta, which is already public. Move the rest of struct roff_man to the parser-internal header roff_int.h. Since the validators need access to the parser state, call them from the top level parser during mparse_result() rather than from the main programs, also reducing code duplication. This keeps parser internal state out of thee main programs (five in mandoc portable) and out of eight formatters.
* Major cleanup; may imply minor changes in edge cases of error reporting.Ingo Schwarze2018-12-141-0/+1
| | | | | | | | | | | Finally, drop support for the run-time configurable mandocmsg() callback. It was over-engineered from the start, never used for anything in a decade, and repeatedly caused maintenance headaches. Consolidate reporting infrastructure into two files, mandoc.h and mandoc_msg.c, mopping up the bits and pieces that were scattered around main.c, read.c, mandoc_parse.h, libmandoc.h, the prototypes of four parsing-related functions, and both parser structs.
* Remove more pointer arithmetic passing via regions outside the arrayIngo Schwarze2018-08-171-4/+3
| | | | | that is undefined according to the C standard. Robert Elz <kre at munnari dot oz dot au> pointed out i wasn't quite done yet.
* Recognize .Bl -column at parse time, and not only at validation time,Ingo Schwarze2017-11-291-9/+14
| | | | | | | even if other arguments precede -column. This is required because the .It parser needs to know whether or not we are a -column list. Fixes tree corruption leading to an assertion failure. Bug reported by bentley@.
* Move .sp to the roff modules. Enough infrastructure is in placeIngo Schwarze2017-05-051-1/+0
| | | | now that this actually saves code: -70 LOC.
* move .ll to the roff modulesIngo Schwarze2017-05-051-1/+0
|
* Parser reorg:Ingo Schwarze2017-05-041-2/+3
| | | | | Generate the first node on the roff level: .br Fix some column numbers in diagnostic messages while here.
* Continue parser unification:Ingo Schwarze2017-04-241-3/+4
| | | | | | | | * Make enum rofft an internal interface as enum roff_tok in "roff.h". * Represent mdoc and man macros in enum roff_tok. * Make TOKEN_NONE a proper enum value and use it throughout. * Put the prologue macros first in the macro tables. * Unify mdoc_macroname[] and man_macroname[] into roff_name[].
* unify names of AST node flags; no change of cpp outputIngo Schwarze2017-01-101-1/+1
|
* Do not access a NULL pointer when a .Bd macro has no arguments at all.Ingo Schwarze2015-10-301-0/+3
| | | | Bug reported by krw@.
* Move all mdoc(7) node validation done before child parsingIngo Schwarze2015-10-211-1/+21
| | | | | | to the new separate validation pass, except for a tiny bit needed by the parser which goes to the new mdoc_state() module; cleaner, simpler, and surprisingly also shorter by 15 lines.
* In order to become able to generate syntax tree nodes on the roff(7)Ingo Schwarze2015-10-201-0/+269
level, validation must be separated from parsing and rewinding. This first big step moves calling of the mdoc(7) post_*() functions out of the parser loop into their own mdoc_validate() pass, while using a new mdoc_state() module to make syntax tree state handling available to both the parser loop and the validation pass.