aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tree.c
Commit message (Collapse)AuthorAgeFilesLines
* preserve comments before .Dd when converting mdoc(7) to man(7)Ingo Schwarze2018-04-111-2/+10
| | | | with mandoc -Tman; suggested by Thomas Klausner <wiz at NetBSD>
* 1. Eliminate struct eqn, instead use the existing membersIngo Schwarze2017-07-081-3/+3
| | | | | | of struct roff_node which is allocated for each equation anyway. 2. Do not keep a list of equation parsers, one parser is enough. Minus fifty lines of code, no functional change.
* garbage collect unused enum member EQN_ROOTIngo Schwarze2017-07-071-4/+1
|
* The EQN_LISTONE box type is pointless.Ingo Schwarze2017-07-051-2/+1
| | | | | | Simplify by just using EQN_LIST with expectargs = 1. Noticed while investigating a bug report from bentley@. No functional change.
* Continue parser unification:Ingo Schwarze2017-04-241-7/+7
| | | | | | | | * 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[].
* In -Ttree output mode, show the BROKEN node flag andIngo Schwarze2017-02-101-1/+3
| | | | provide a -Onoval output option to show the unvalidated tree.
* show meta data for -Ttree outputIngo Schwarze2017-01-121-4/+28
|
* unify names of AST node flags; no change of cpp outputIngo Schwarze2017-01-101-7/+7
|
* Introduce flags NODE_NOSRC and NODE_NOPRT for AST nodes.Ingo Schwarze2017-01-101-1/+5
| | | | | | | | | Use them to mark generated nodes and nodes that shall not produce output. Let -Ttree output mode display these new flags. Use NODE_NOSRC for .Ar, .Mt, and .Pa default arguments. Use NODE_NOPRT for .Dd, .Dt, and .Os. These will help to make handling of text production macros more rigorous.
* To make the code more readable, delete 283 /* FALLTHROUGH */ commentsIngo Schwarze2015-10-121-6/+1
| | | | | | that were right between two adjacent case statement. Keep only those 24 where the first case actually executes some code before falling through to the next case.
* Show the flags MDOC_DELIMO, MDOC_DELIMC, MDOC_EOS, and MAN_EOS.Ingo Schwarze2015-09-261-8/+18
| | | | Drop the "block-" prefixes from the node type names.
* /* NOTREACHED */ after abort() is silly, delete itIngo Schwarze2015-09-261-5/+1
|
* Delete the wrapper functions mdoc_meta(), man_meta(), mdoc_node(),Ingo Schwarze2015-04-181-3/+3
| | | | | | man_node() from the mandoc(3) semi-public interface and the internal wrapper functions print_mdoc() and print_man() from the HTML formatters. Minus 60 lines of code, no functional change.
* Replace the structs mdoc and man by a unified struct roff_man.Ingo Schwarze2015-04-181-3/+3
| | | | | Almost completely mechanical, no functional change. Written on the train from Exeter to London returning from p2k15.
* Second step towards parser unification:Ingo Schwarze2015-04-021-5/+5
| | | | | | | | | Replace struct mdoc_node and struct man_node by a unified struct roff_node. To be able to use the tok member for both mdoc(7) and man(7) without defining all the macros in roff.h, sacrifice a tiny bit of type safety and make tok an int rather than an enum. Almost mechanical, no functional change. Written on the Eurostar from Bruxelles to London on the way to p2k15.
* First step towards parser unification:Ingo Schwarze2015-04-021-39/+40
| | | | | | Replace enum mdoc_type and enum man_type by a unified enum roff_type. Almost mechanical, no functional change. Written on the ICE train from Frankfurt to Bruxelles on the way to p2k15.
* Simplify by deleting the "lastline" member of struct mdoc_node.Ingo Schwarze2015-02-051-5/+2
| | | | Minus one struct member, minus 17 lines of code, no functional change.
* reduce indentation for better readabilityIngo Schwarze2015-02-031-13/+21
|
* Simplify by making many functions in the man(7) parser void,Ingo Schwarze2014-11-281-6/+1
| | | | and some cleanup; no functional change, minus 70 lines.
* show the {MDOC,MAN}_EQN node, it contains interesting information,Ingo Schwarze2014-10-201-11/+13
| | | | | in particular line and column numbers and flags; but hide the uninteresting EQN_ROOT box
* sync Copyright years after merge to OpenBSD; no code changeIngo Schwarze2014-10-101-2/+2
|
* Make eqn(7) -Ttree output more useful:Ingo Schwarze2014-10-101-9/+28
| | | | | | | * Reduce noise by not printing default attributes. * Print missing "top" and "bottom" attributes. * Print mnemonics, not code numbers for expression positions. * Do not print unused "pile" attribute.
* Re-write of eqn(7) parser and MathML output.Kristaps Dzonsons2014-10-101-3/+8
| | | | | | | | | | This adds parser-level support for the grammar described by the eqn second-edition technical paper, "Typesetting Mathematics — User's Guide" (Kernighan, Cherry). The reason for this re-write is the grouping rules, which were not possible given the existing implementation. The re-write has also considerably simplified the HTML (and, if it ever is completed, terminal) front-end.
* Make eqn tree output a bit more useful.Kristaps Dzonsons2014-09-281-3/+3
|
* Get rid of HAVE_CONFIG_H, it is always defined; idea from libnbcompat.Ingo Schwarze2014-08-101-3/+3
| | | | | | Include <sys/types.h> where needed, it does not belong in config.h. Remove <stdio.h> from config.h; if it is missing somewhere, it should be added, but i cannot find a *.c file where it is missing.
* Change column display in -Ttree to be 1-based instead of 0-basedIngo Schwarze2014-07-021-4/+4
| | | | such that column numbers agree between messages and -Ttree.
* KNF: case (FOO): -> case FOO:, remove /* LINTED */ and /* ARGSUSED */,Ingo Schwarze2014-04-201-59/+54
| | | | | remove trailing whitespace and blanks before tabs, improve some indenting; no functional change
* To find out whether .TP head arguments are same-line or next-line arguments,Ingo Schwarze2014-03-081-3/+6
| | | | | | | | use the MAN_LINE flag instead of the man_node line member. This is required such that user-defined macros wrapping .TP work correctly. Issue found by Havard Eidnes in Tcl_NewStringObj(3), reported via the NetBSD bug tracking system and Thomas Klausner <wiz at NetBSD>.
* When deciding whether two consecutive macros are on the same input line,Ingo Schwarze2013-12-241-2/+6
| | | | | | | | we have to compare the line where the first one *ends* (not where it begins) to the line where the second one starts. This fixes the bug that .Bk allowed output line breaks right after block macros spanning more than one input line, even when the next macro follows on the same line.
* For some mdoc(7) macros, it is (unfortunately) semantically significantIngo Schwarze2013-09-151-3/+6
| | | | | | whether they are the first macro on the line or called by another macro. To help debugging, indicate this property "first macro on a new input line" by prefixing an asterisk to the line number in -Ttree output.
* Remove the variable sz because it's invariantly == 0,Ingo Schwarze2013-05-181-8/+3
| | | | | | | | | along with the dead code testing whether it's positive. Reported by Ulrich Spoerlein <uqs@spoerlein.net>, found by Coverity Scan CID 975717. While here, remove the now unused **params array as well, which Coverity apparently missed, at least it wasn't reported...
* forgotten Copyright bumps; no code changeIngo Schwarze2011-09-181-2/+2
| | | | found while syncing to OpenBSD
* Add matrix support. Also remove "above" notion, as all elements in aKristaps Dzonsons2011-07-231-23/+18
| | | | list are delimited by their "aboveness" and it's superfluous.
* Give lists their own eqn function.Kristaps Dzonsons2011-07-221-1/+10
|
* Complete eqn.7 parsing. Features all productions from the original 1975Kristaps Dzonsons2011-07-211-5/+8
| | | | | | | | CACM paper in an LR(1) parse (1 -> eqn_rewind()). Right now the code is a little jungly, but will clear up as I consolidate parse components. The AST structure will also be cleaned up, as right now it's pretty ad hoc (this won't change the parse itself). I added the mandoc_strndup() function will here.
* Support `size' constructs in eqn.7. Generalise mandoc_strontou to thisKristaps Dzonsons2011-07-211-4/+8
| | | | effect.
* Full support for eqn positionals (above, over, sup, sub, etc.).Kristaps Dzonsons2011-07-211-7/+7
|
* Add eqn subexpression fonts.Kristaps Dzonsons2011-07-211-4/+7
|
* Add support for markers. These decorate the last box: see eqn.7.Kristaps Dzonsons2011-07-211-4/+4
|
* Support nested `{, }' subexpressions in eqn. Document in code.Kristaps Dzonsons2011-07-211-4/+9
|
* Flip eqn into using parsed nodes. I've temporarily disabled printingKristaps Dzonsons2011-07-211-25/+45
| | | | | | | these in the front-ends except for -Ttree, which will display the parsed tree. While here, fix that quoted strings aren't scanned for replacement parts.
* Add MAN_TAIL, which will be used by `UE' (forthcoming) and needs to beKristaps Dzonsons2011-03-231-1/+6
| | | | used for `RE'.
* Allow -man to process EQN as well. Also fix a segfault in missing caseKristaps Dzonsons2011-02-091-2/+2
| | | | statements in the post-handler for EQN in -mdoc and -man.
* Allow EQN data to be pushed down into libmdoc via mdoc_addeqn(). OnlyKristaps Dzonsons2011-02-091-2/+2
| | | | the adding itself is implemented; equation data is not yet shown.
* Let the line-number of a tbl_span be remembered.Kristaps Dzonsons2011-02-061-5/+4
|
* Add initial libmdoc and libman top-most machinery for accepting TBLKristaps Dzonsons2011-02-061-1/+13
| | | | | directives. For now this will just ignore them (except for -Ttree, which just notes that an EQN's been accepted).
* First, make extra data cells be thrown away. This makes "dp->layout"Kristaps Dzonsons2011-01-101-2/+7
| | | | | | | | | | | | always hold, which cleans up the table stuff a bit. Second, set a "spans" value per data cell consisting of the number of skipped TBL_CELL_SPAN layout cells. Third, make tbl_term.c understand how to skip over spanned sections when iterating over the header queue. What remains is to calculate the widths of spanned cells.
* Make width calculations occur within tbl_term.c, not tbl.c. This allowsKristaps Dzonsons2011-01-031-14/+1
| | | | | | | | | | | | | | | | for front-ends to make decisions about widths, not the back-end. To pull this off, first make each tbl_head contain a unique index value (0 <= index < total tbl_head elements) and remove the tbl_calc() routine from the back-end. Then, when encountering the first tbl_span in the front-end, dynamically create an array of configurations (termp_tbl) keyed on each tbl_head's unique index value. Construct the decimals and widths at this time, then continue parsing as before. The termp_tbl and indexes are required because we pass a const tbl AST into the front-end.
* Fix table to print nicely (merging error). Also have -Ttree push out someKristaps Dzonsons2011-01-021-12/+29
| | | | header stuff.
* Add a warning if a data cell has no layout. Also make -Ttree show thisKristaps Dzonsons2011-01-011-2/+2
| | | | with a little star next to the entry (yeah, this is mostly for testing).