summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc/mdoc_validate.c
AgeCommit message (Collapse)Author
2015-02-04discard .Rs head arguments and improve .Rs diagnosticsIngo Schwarze
2015-02-04more specific .Nd diagnostics, allowing to get rid of enum check_lvlIngo Schwarze
and the respective argument of check_count()
2015-02-03Bring .Pp/.Lp handling inside .Nm blocks closer to groff;Ingo Schwarze
as a bonus, get rid of another call to rew_sub().
2014-12-18Only keep leading .Sm inside a list when it immediately precedesIngo Schwarze
the first .It. Otherwise, move it out together with whatever follows. Fixing an assertion failure found by jsg@ with afl.
2014-12-18When the head of a list item is extended with a partial explicitIngo Schwarze
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.
2014-11-30Multiple fixes with respect to .Pf:Ingo Schwarze
* 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.
2014-11-28Retire support for CSRG supplementary document titles. These areIngo Schwarze
long obsolete and were never written in mdoc(7) in the first place. Removes 100 lines from source files.
2014-11-28Drop useless architecture table. Validating architecture namesIngo Schwarze
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@.
2014-11-28Remove bulky, irrelevant library description string tablesIngo Schwarze
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@.
2014-11-28Simplify code by making mdoc validation handlers void.Ingo Schwarze
No functional change, minus 90 lines of code.
2014-11-27Downgrade .Bd -file from FATAL to ERROR.Ingo Schwarze
Since this was the last remaining FATAL error in this area, this change will allow major simplifications in the mdoc(7) parser.
2014-11-27Fix the obsolete .Db (toggle debug mode) macro to ignore its argumentsIngo Schwarze
and not trigger an assertion when there is more than one argument; the latter found by jsg@ with afl.
2014-11-26remove an unreachable warning about .Sm argumentsIngo Schwarze
2014-11-17Multiple fixes with respect to in-line macros:Ingo Schwarze
* .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@.
2014-10-30Major bugsquashing with respect to -offset and -width:Ingo Schwarze
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@.
2014-10-13Do not warn about declarations of functions returning function pointers,Ingo Schwarze
getting rid of a false positive noticed by bentley@.
2014-10-11oops, don't crash when .Fo has no argumentIngo Schwarze
2014-10-11warn about parentheses in function names after .Fn and .Fo;Ingo Schwarze
particularly useful when converting from other languages to mdoc(7); feature suggested by bentley@
2014-09-12warn about commas in function arguments; inspired by mdoclint(1)Ingo Schwarze
2014-09-11warn about botched .Xr ordering and punctuation below SEE ALSO;Ingo Schwarze
inspired by mdoclint(1)
2014-09-07warn about AUTHORS sections without .An macros, inspired by mdoclint(1)Ingo Schwarze
2014-09-07Allow .ll in the prologue; Daniel Levai reports Slackware Linux uses this.Ingo Schwarze
2014-08-19Do not dereference a NULL pointer if a .Bl macro hasIngo Schwarze
no -type, -width, -offset or -compact arguments whatsoever; this got broken in mdoc_validate.c rev. 1.156. While here, sort headers.
2014-08-08Bring the handling of defective prologues even closer to groff,Ingo Schwarze
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.
2014-08-08Simplify by allowing only one post-handler.Ingo Schwarze
Saves 36 static arrays and 10 lines of code at the expense of only five new trivial static functions. No functional change.
2014-08-08Simplify by allowing only one pre-handler.Ingo Schwarze
Saves 12 static arrays and 19 lines of code. No functional change.
2014-08-08demacrify: get rid of man_nmsg(), man_pmsg(), mdoc_nmsg(), mdoc_pmsg()Ingo Schwarze
2014-08-08mention requests and macros in more messagesIngo Schwarze
2014-08-08Split MANDOCERR_IGNARGV into one message for .An and one for .BlIngo Schwarze
and report the macro name and argument.
2014-08-08In .Bl -column, if some of the column width declarations are givenIngo Schwarze
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.
2014-08-08Remove the useless FATAL error "argument count wrong, violates syntax".Ingo Schwarze
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.
2014-08-08Get rid of the useless FATAL error "child violates parent syntax".Ingo Schwarze
When finding items outside lists, simply skip them and throw an ERROR. Handle subsections before the first section instead of bailing out.
2014-08-08Remove two useless FATAL errors.Ingo Schwarze
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.
2014-08-08better name and wording for the last two non-generic errorsIngo Schwarze
2014-08-08Various improvements related to .Ex and .Rv:Ingo Schwarze
* let .Nm fall back to the empty string, not to UNKNOWN * never let .Rv copy an argument from .Nm * avoid spurious \fR after empty .Nm in -Tman * correct handling of .Ex and .Rv in -Tman * correct the wording of the output for .Rv without arguments * use non-breaking spaces in .Ex and .Rv output where required * split MANDOCERR_NONAME into a warning for .Ex and an error for .Nm
2014-08-08Partial implementation of .Bd -centered.Ingo Schwarze
In groff, .Bd -centered operates in fill mode, which is relatively hard to implement, while this implementation operates in non-fill mode so far. As long as you pay attention that your lines do not overflow, it works. To make sure that rendering is the same for mandoc and groff, it is recommended to insert .br between lines for now. This implementation will need improvement later.
2014-07-07no need to delete any content from .Rs blocks,Ingo Schwarze
and downgrade the related message from ERROR to WARNING
2014-07-06Clean up messages related to plain text and to escape sequences.Ingo Schwarze
* Mention invalid escape sequences and string names, and fallbacks. * Hierarchical naming.
2014-07-05Cleanup with respect to bad macro arguments.Ingo Schwarze
* Fix .Sm with invalid arg: move arg out and toggle mode. * Promote "unknown standard" from WARNING to ERROR, it loses information. * Delete MANDOCERR_BADWIDTH, it would only indicate a mandoc(1) bug. * Do not report MANDOCERR_BL_LATETYPE when there is no type at all. * Mention macro names, arguments and fallbacks.
2014-07-05Cleanup regarding -offset and -width:Ingo Schwarze
* Bugfix: Last one wins, not first one. * Fix .Bl -width without argument: it means 0n, so do not ignore it. * Report macro names, argument names and fallbacks in related messages. * Simplify: Garbage collect auxiliary variables in pre_bd() and pre_bl().
2014-07-04Clean up messages regarding excess arguments:Ingo Schwarze
* Downgrade ".Bf -emphasis Em" from FATAL to WARNING. * Mention the macros, the arguments, and the fallbacks. * Hierarchical naming. Also fix the handling of excess .It head arguments in -Tman.
2014-07-04Clean up messages related to missing arguments.Ingo Schwarze
* Do not warn about empty -column cells, they seem valid to me. * Downgrade empty item and missing -std from ERROR to WARNING. * Hierarchical naming. * Descriptive, not imperative style. * Mention macro names, argument names, and fallbacks. * Garbage collect some unreachable code in post_it().
2014-07-03Fix formatting of empty .Bl -inset item heads.Ingo Schwarze
Downgrade empty item heads from ERROR to WARNING. Show the list type in the error message. Choose better variable names for nodes in post_it().
2014-07-02Improve and test the messages about empty macros,Ingo Schwarze
in particular reporting the macro names involved.
2014-07-02When .Sm is called without an argument, groff toggles the spacing mode,Ingo Schwarze
so let us do the same for compatibility. Using this feature is of course not recommended except in manual page obfuscation contests.
2014-07-02Disentangle the MANDOCERR_CHILD message, which reported threeIngo Schwarze
completely different things, into three distinct messages. Also mention the macro names we are talking about.
2014-07-02Clean up warnings related to macros and nesting.Ingo Schwarze
* Hierarchical naming of enum mandocerr items. * Improve the wording to make it comprehensible. * Mention the offending macro. * Garbage collect one chunk of ancient, long unreachable code.
2014-07-02Improve "skipping paragraph macro" messages,Ingo Schwarze
showing which macro was skipped and before or after what.
2014-07-02Implement the obsolete macros .En .Es .Fr .Ot for backward compatibility,Ingo Schwarze
since this is hardly more complicated than explicitly ignoring them as we did in the past. Of course, do not use them!
2014-07-01Clean up the warnings related to document structure.Ingo Schwarze
* Hierarchical naming of the related enum mandocerr items. * Mention the offending macro, section title, or string. While here, improve some wordings: * Descriptive instead of imperative style. * Uniform style for "missing" and "skipping". * Where applicable, mention the fallback used.