summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/mdoc_validate.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Unify node handling functions:schwarze2015-04-191-15/+16
| | | | | | | | | | | * node_alloc() for mdoc and man_node_alloc() -> roff_node_alloc() * node_append() for mdoc and man_node_append() -> roff_node_append() * mdoc_head_alloc() and man_head_alloc() -> roff_head_alloc() * mdoc_body_alloc() and man_body_alloc() -> roff_body_alloc() * mdoc_node_unlink() and man_node_unlink() -> roff_node_unlink() * mdoc_node_free() and man_node_free() -> roff_node_free() * mdoc_node_delete() and man_node_delete() -> roff_node_delete() Minus 130 lines of code, no functional change.
* Replace the structs mdoc and man by a unified struct roff_man.schwarze2015-04-181-15/+15
| | | | | Almost completely mechanical, no functional change. Written on the train from Exeter to London returning from p2k15.
* Second step towards parser unification:schwarze2015-04-021-56/+56
| | | | | | | | | 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:schwarze2015-04-021-49/+50
| | | | | | 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.
* oops, in NAME, don't nag about the comma after .Nmschwarze2015-02-231-1/+5
|
* improve NAME section diagnostics;schwarze2015-02-231-25/+25
| | | | confusing messages reported by Jan Stary <hans at stare dot cz>
* Render \(lq and \(rq as '"' in -Tascii mode but leave the renderingschwarze2015-02-171-2/+2
| | | | | | of .Do/.Dc, .Dq, .Lb, and .St untouched. Reduces groff-mandoc differences in base by about 7%. Reminded of the issue by naddy@.
* clean up post_dt() validation function;schwarze2015-02-161-43/+41
| | | | improved diagnostics, minus six lines of code
* shut up about tabs in SYNOPSIS .Fd lines, there is no good way to avoid themschwarze2015-02-141-2/+3
|
* Delete the mdoc_node.pending pointer and the function calculatingschwarze2015-02-121-40/+6
| | | | | | | | | | | | | | | | | | | | | | | it, make_pending(), which was the most difficult function of the whole mdoc(7) parser. After almost five years of maintaining this hellhole, i just noticed the pointer isn't needed after all. Blocks are always rewound in the reverse order they were opened; that even holds for broken blocks. Consequently, it is sufficient to just mark broken blogs with the flag MDOC_BROKEN and breaking blocks with the flag MDOC_ENDED. When rewinding, instead of iterating the pending pointers, just iterate from each broken block to its parents, rewinding all that are MDOC_ENDED and stopping after processing the first ancestor that it not MDOC_BROKEN. For ENDBODY markers, use the mdoc_node.body pointer in place of the former mdoc_node.pending. This also fixes an assertion failure found by jsg@ with afl, test case #467 (Bo Bl It Bd Bc It), where (surprise surprise) the pending pointer got corrupted. Improved functionality, minus one function, minus one struct field, minus 50 lines of code.
* trim trailing white space, no code change;schwarze2015-02-101-2/+2
| | | | from Svyatoslav Mishyn <juef at openmailboxd dot org>, Crux Linux
* replace the last legacy generic message type, "argument count wrong",schwarze2015-02-061-3/+3
| | | | by more specific messages, improving diagnostics for .cc .tr .Bl -column
* Delete the legacy generic warning type MANDOCERR_ARGCWARN,schwarze2015-02-061-81/+19
| | | | | replacing the last instances by more specific warnings. Improved functionality, minus 50 lines of code.
* better handle .Fo and .Fd without argumentschwarze2015-02-061-13/+22
| | | | better handle .Fo with more than one argument
* better handle empty .Bd .Bl .D1 .Dl blocksschwarze2015-02-061-39/+45
|
* better handle .In .Sh .Ss .St .Xr without argumentsschwarze2015-02-061-11/+3
|
* fix handling of empty .An macrosschwarze2015-02-051-5/+7
|
* Discard excess head arguments for .Bd .Bl .Bk and delete hwarn_eq0().schwarze2015-02-041-36/+37
| | | | | Discard empty .Bk blocks. Improve related diagnostics.
* improve diagnostics regarding arguments of .An .Pp .Lp .br .spschwarze2015-02-041-11/+15
| | | | in particular, get rid of check_count(..., CHECK_EQ, 0)
* discard .Rs head arguments and improve .Rs diagnosticsschwarze2015-02-041-36/+34
|
* more specific .Nd diagnostics, allowing to get rid of enum check_lvlschwarze2015-02-041-25/+27
| | | | and the respective argument of check_count()
* Bring .Pp/.Lp handling inside .Nm blocks closer to groff;schwarze2015-02-031-4/+12
| | | | as a bonus, get rid of another call to rew_sub().
* Only keep leading .Sm inside a list when it immediately precedesschwarze2014-12-181-2/+5
| | | | | the first .It. Otherwise, move it out together with whatever follows. Fixing an assertion failure found by jsg@ with afl.
* When the head of a list item is extended with a partial explicitschwarze2014-12-181-7/+7
| | | | | | | | macro (for example .Xo) and never closed again, the item ends up without a body block. This can even happen for list types that usually don't have heads in the first place. So even in this case, check for the existence of the body before accessing it. NULL pointer access found by jsg@ with afl.
* Multiple fixes with respect to .Pf:schwarze2014-11-301-2/+2
| | | | | | | * The first argument of .Pf is not parsed. * Normal delimiter handling does not apply to the first argument of .Pf. * Warn if nothing follows a prefix (inspired by groff_mdoc(7)). * In that case, do not suppress spacing.
* Retire support for CSRG supplementary document titles. These areschwarze2014-11-281-13/+3
| | | | | long obsolete and were never written in mdoc(7) in the first place. Removes 100 lines from source files.
* Drop useless architecture table. Validating architecture namesschwarze2014-11-281-14/+7
| | | | | | is a job for makewhatis(8)/mandoc.db(5), not for the parser. Removes 150 lines from source files and 4k (1%) from the binary. Bloat found by deraadt@.
* Remove bulky, irrelevant library description string tablesschwarze2014-11-281-12/+2
| | | | | | | not used by a single manual in OpenBSD and just print library names; will remain in the portable version for use by FreeBSD and NetBSD. Removes 150 lines from source tree and 16 Kilobytes (4%) from binary. Bloat found by deraadt@.
* Simplify code by making mdoc validation handlers void.schwarze2014-11-281-323/+222
| | | | No functional change, minus 90 lines of code.
* Downgrade .Bd -file from FATAL to ERROR.schwarze2014-11-271-2/+2
| | | | | Since this was the last remaining FATAL error in this area, this change will allow major simplifications in the mdoc(7) parser.
* Fix the obsolete .Db (toggle debug mode) macro to ignore its argumentsschwarze2014-11-271-19/+13
| | | | | and not trigger an assertion when there is more than one argument; the latter found by jsg@ with afl.
* remove an unreachable warning about .Sm argumentsschwarze2014-11-261-3/+1
|
* Multiple fixes with respect to in-line macros:schwarze2014-11-171-6/+16
| | | | | | | | | | * .No selects the default font; relevant e.g. in .Bf blocks * no need to force empty .Li elements * closing delimiters as leading macro arguments do not suppress space * opening delimiters at the end of a macro line do not suppress space * correctly handle delimiter spacing in -Tman As a side effect, these fixes let mandoc warn about empty .No macros as requested by bentley@.
* Major bugsquashing with respect to -offset and -width:schwarze2014-10-301-43/+19
| | | | | | | | | 1. Support specifying the .Bd and .Bl -offset as a macro default width; while here, simplify the code handling the same for .Bl -width. 2. Correct handling of .Bl -offset arguments: unlike .Bd -offset, the arguments "left", "indent", and "indent-two" have no special meaning. 3. Fix the scaling of string length -offset and -width arguments in -Thtml. Triggered by an incomplete documentation patch from bentley@.
* Do not warn about declarations of functions returning function pointers,schwarze2014-10-131-4/+6
| | | | getting rid of a false positive noticed by bentley@.
* oops, don't crash when .Fo has no argumentschwarze2014-10-111-2/+2
|
* warn about parentheses in function names after .Fn and .Fo;schwarze2014-10-111-2/+29
| | | | | particularly useful when converting from other languages to mdoc(7); feature suggested by bentley@
* warn about commas in function arguments; inspired by mdoclint(1)schwarze2014-09-121-3/+26
|
* warn about botched .Xr ordering and punctuation below SEE ALSO;schwarze2014-09-111-1/+67
| | | | inspired by mdoclint(1)
* warn about AUTHORS sections without .An macros, inspired by mdoclint(1)schwarze2014-09-071-9/+40
|
* Allow .ll in the prologue; Daniel Levai reports Slackware Linux uses this.schwarze2014-09-071-10/+9
|
* Do not dereference a NULL pointer if a .Bl macro hasschwarze2014-08-191-4/+4
| | | | | | no -type, -width, -offset or -compact arguments whatsoever; this got broken in mdoc_validate.c rev. 1.156. While here, sort headers.
* Bring the handling of defective prologues even closer to groff,schwarze2014-08-081-81/+73
| | | | | | | | | | | | in particular relaxing the distinction between prologue and body and further improving messages. * The last .Dd wins and the last .Os wins, even in the body. * The last .Dt before the first body macro wins. * Missing title in .Dt defaults to UNTITLED. Warn about it. * Missing section in .Dt does not default to 1. But warn about it. * Do not warn multiple times about the same mdoc(7) prologue macro. * Warn about missing .Os. * Incomplete .TH defaults to empty strings. Warn about it.
* Simplify by allowing only one post-handler.schwarze2014-08-081-128/+150
| | | | | | Saves 36 static arrays and 10 lines of code at the expense of only five new trivial static functions. No functional change.
* Simplify by allowing only one pre-handler.schwarze2014-08-081-47/+29
| | | | | Saves 12 static arrays and 19 lines of code. No functional change.
* demacrify: get rid of man_nmsg(), man_pmsg(), mdoc_nmsg(), mdoc_pmsg()schwarze2014-08-081-3/+5
|
* mention requests and macros in more messagesschwarze2014-08-081-33/+45
|
* Split MANDOCERR_IGNARGV into one message for .An and one for .Blschwarze2014-08-081-10/+22
| | | | and report the macro name and argument.
* In .Bl -column, if some of the column width declarations are givenschwarze2014-08-081-21/+13
| | | | | | | | | | | | | right after the -column argument and some at the very end of the argument list, after some other arguments like -compact, concatenate the column lists. This gets rid of one of the last useless FATAL errors and actually shortens the code by a few lines. This fixes an issue introduced more than five years ago, at first causing an assert() since bsd.lv mdoc_action.c rev. 1.14 (June 17, 2009), then later a FATAL error since mdoc_validate rev. 1.130 (Nov. 30, 2010), and marked as "TODO" ever since.
* Remove the useless FATAL error "argument count wrong, violates syntax".schwarze2014-08-081-12/+6
| | | | | | The last remaining instance was .It in .Bl -column with more than one excessive .Ta. However, simply downgrading from FATAL to ERROR, it just works fine, almost the same way as in groff, without any other changes.