aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_state.c
Commit message (Collapse)AuthorAgeFilesLines
* Correctly set the ROFF_NOFILL parser flag for .Bd .Ed .Sh, suchIngo Schwarze2019-01-011-40/+3
| | | | | | 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-3/+3
| | | | | | 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-9/+1
| | | | | | | | | 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-1/+2
| | | | | | | | | | | | | | 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-1/+2
| | | | | | | | | | | 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-5/+4
| | | | | 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-10/+15
| | | | | | | 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-2/+1
| | | | now that this actually saves code: -70 LOC.
* move .ll to the roff modulesIngo Schwarze2017-05-051-2/+1
|
* Parser reorg:Ingo Schwarze2017-05-041-3/+4
| | | | | 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-4/+5
| | | | | | | | * 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-2/+2
|
* Do not access a NULL pointer when a .Bd macro has no arguments at all.Ingo Schwarze2015-10-301-1/+4
| | | | Bug reported by krw@.
* Move all mdoc(7) node validation done before child parsingIngo Schwarze2015-10-211-2/+22
| | | | | | 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.