summaryrefslogtreecommitdiffstats
path: root/mdoc_validate.c
Commit message (Collapse)AuthorAgeFilesLines
* oops, in NAME, don't nag about the comma after .NmIngo Schwarze2015-02-231-0/+4
|
* improve NAME section diagnostics;Ingo Schwarze2015-02-231-24/+24
| | | | confusing messages reported by Jan Stary <hans at stare dot cz>
* Render \(lq and \(rq as '"' in -Tascii mode but leave the renderingIngo Schwarze2015-02-171-1/+1
| | | | | | of .Do/.Dc, .Dq, .Lb, and .St untouched. Reduces groff-mandoc differences in OpenBSD base by about 7%. Reminded of the issue by naddy@.
* clean up post_dt() validation function;Ingo Schwarze2015-02-161-42/+40
| | | | improved diagnostics, minus six lines of code
* shut up about tabs in SYNOPSIS .Fd lines, there is no good way to avoid themIngo Schwarze2015-02-141-1/+2
|
* Delete the mdoc_node.pending pointer and the function calculatingIngo Schwarze2015-02-121-39/+5
| | | | | | | | | | | | | | | | | | | | | | | 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;Ingo Schwarze2015-02-101-1/+1
| | | | from Svyatoslav Mishyn <juef at openmailboxd dot org>, Crux Linux
* replace the last legacy generic message type, "argument count wrong",Ingo Schwarze2015-02-061-2/+2
| | | | by more specific messages, improving diagnostics for .cc .tr .Bl -column
* Delete the legacy generic warning type MANDOCERR_ARGCWARN,Ingo Schwarze2015-02-061-80/+18
| | | | | replacing the last instances by more specific warnings. Improved functionality, minus 50 lines of code.
* better handle .Fo and .Fd without argumentIngo Schwarze2015-02-061-12/+21
| | | | better handle .Fo with more than one argument
* better handle empty .Bd .Bl .D1 .Dl blocksIngo Schwarze2015-02-061-38/+44
|
* better handle .In .Sh .Ss .St .Xr without argumentsIngo Schwarze2015-02-061-10/+2
|
* fix handling of empty .An macrosIngo Schwarze2015-02-051-4/+6
|
* Discard excess head arguments for .Bd .Bl .Bk and delete hwarn_eq0().Ingo Schwarze2015-02-041-35/+36
| | | | | Discard empty .Bk blocks. Improve related diagnostics.
* improve diagnostics regarding arguments of .An .Pp .Lp .br .spIngo Schwarze2015-02-041-10/+14
| | | | in particular, get rid of check_count(..., CHECK_EQ, 0)
* discard .Rs head arguments and improve .Rs diagnosticsIngo Schwarze2015-02-041-35/+33
|
* more specific .Nd diagnostics, allowing to get rid of enum check_lvlIngo Schwarze2015-02-041-24/+26
| | | | and the respective argument of check_count()
* Bring .Pp/.Lp handling inside .Nm blocks closer to groff;Ingo Schwarze2015-02-031-3/+11
| | | | as a bonus, get rid of another call to rew_sub().
* Only keep leading .Sm inside a list when it immediately precedesIngo Schwarze2014-12-181-1/+4
| | | | | 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 explicitIngo Schwarze2014-12-181-6/+6
| | | | | | | | 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:Ingo Schwarze2014-11-301-1/+1
| | | | | | | * 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 areIngo Schwarze2014-11-281-12/+2
| | | | | 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 namesIngo Schwarze2014-11-281-13/+6
| | | | | | 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@.
* kill a pointless assertIngo Schwarze2014-11-281-3/+0
|
* Simplify code by making mdoc validation handlers void.Ingo Schwarze2014-11-281-322/+221
| | | | No functional change, minus 90 lines of code.
* Downgrade .Bd -file from FATAL to ERROR.Ingo Schwarze2014-11-271-1/+1
| | | | | 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 argumentsIngo Schwarze2014-11-271-17/+12
| | | | | 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 argumentsIngo Schwarze2014-11-261-2/+0
|
* Multiple fixes with respect to in-line macros:Ingo Schwarze2014-11-171-5/+15
| | | | | | | | | | * .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:Ingo Schwarze2014-10-301-42/+18
| | | | | | | | | 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@.
* sync with OpenBSD:Ingo Schwarze2014-10-131-1/+2
| | | | | check sorting of .Xr's case-insensitively; no idea why this was different here
* Do not warn about declarations of functions returning function pointers,Ingo Schwarze2014-10-131-3/+5
| | | | getting rid of a false positive noticed by bentley@.
* oops, don't crash when .Fo has no argumentIngo Schwarze2014-10-111-1/+1
|
* warn about parentheses in function names after .Fn and .Fo;Ingo Schwarze2014-10-111-1/+28
| | | | | particularly useful when converting from other languages to mdoc(7); feature suggested by bentley@
* warn about commas in function arguments; inspired by mdoclint(1)Ingo Schwarze2014-09-121-2/+25
|
* warn about botched .Xr ordering and punctuation below SEE ALSO;Ingo Schwarze2014-09-111-0/+65
| | | | inspired by mdoclint(1)
* warn about AUTHORS sections without .An macros, inspired by mdoclint(1)Ingo Schwarze2014-09-071-8/+39
|
* Allow .ll in the prologue; Daniel Levai reports Slackware Linux uses this.Ingo Schwarze2014-09-071-9/+8
|
* Do not dereference a NULL pointer if a .Bl macro hasIngo Schwarze2014-08-191-1/+1
| | | | | no -type, -width, -offset or -compact arguments whatsoever; this got broken in rev. 1.238.
* Get rid of HAVE_CONFIG_H, it is always defined; idea from libnbcompat.Ingo Schwarze2014-08-101-4/+1
| | | | | | 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.
* Bring the handling of defective prologues even closer to groff,Ingo Schwarze2014-08-061-80/+72
| | | | | | | | | | | | 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.Ingo Schwarze2014-08-021-127/+149
| | | | | | 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.Ingo Schwarze2014-08-011-46/+28
| | | | | Saves 12 static arrays and 19 lines of code. No functional change.
* demacrify: get rid of man_nmsg(), man_pmsg(), mdoc_nmsg(), mdoc_pmsg()Ingo Schwarze2014-08-011-2/+4
|
* mention requests and macros in more messagesIngo Schwarze2014-08-011-32/+44
|
* Split MANDOCERR_IGNARGV into one message for .An and one for .BlIngo Schwarze2014-07-311-9/+21
| | | | and report the macro name and argument.
* In .Bl -column, if some of the column width declarations are givenIngo Schwarze2014-07-311-20/+12
| | | | | | | | | | | | | 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 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".Ingo Schwarze2014-07-301-11/+5
| | | | | | 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.
* Get rid of the useless FATAL error "child violates parent syntax".Ingo Schwarze2014-07-301-53/+3
| | | | | When finding items outside lists, simply skip them and throw an ERROR. Handle subsections before the first section instead of bailing out.
* Remove two useless FATAL errors.Ingo Schwarze2014-07-301-7/+15
| | | | | When a file contains neither text nor macros, treat it as an empty document. When the mdoc(7) document prologue is incomplete, use some default values.