aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_validate.c
Commit message (Collapse)AuthorAgeFilesLines
* correctly handle letters in .Nx arguments; improves for exampleIngo Schwarze2017-07-201-1/+16
| | | | getpgid(2), ac(8), ldconfig(8), mount_ffs(8), sa(8), ttyflags(8), ...
* If -column, -diag, -inset, -item, or -ohang lists have a -width,Ingo Schwarze2017-07-151-5/+6
| | | | | don't just talk about ignoring it, actually do ignore it. No change for terminal output, improves HTML output.
* report trailing delimiters after macros where they are usually a mistake;Ingo Schwarze2017-07-031-49/+95
| | | | the idea came up in a discussion with Thomas Klausner <wiz at NetBSD>
* add warning "cross reference to self"; inspired by mdoclintIngo Schwarze2017-07-021-3/+13
|
* Basic reporting of .Xrs to manual pages that don't existIngo Schwarze2017-07-011-2/+6
| | | | | | | | | | | | in the base system, inspired by mdoclint(1). We are able to do this because (1) the -mdoc parser, the -Tlint validator, and the man(1) manual page lookup code are all in the same program and (2) the mandoc.db(5) database format allows fast lookup. Feedback from, previous versions tested by, and OK jmc@. A few features will be added to this in the tree, step by step.
* warn about some non-portable idioms in .Bl -column;Ingo Schwarze2017-06-291-5/+20
| | | | triggered by a question from Yuri Pankov (illumos)
* warn about .Ns macros that have no effect because they are followedIngo Schwarze2017-06-271-3/+6
| | | | by an isolated closing delimiter; inspired by mdoclint
* Catch typos in .Sh names; suggested by jmc@.Ingo Schwarze2017-06-251-2/+63
| | | | | | I'm using a very simple, linear time / zero space fuzzy string matching heuristic rather than a full Levenshtein metric, to keep the code both simple and fast.
* operating system dependent message about unknown architecture;Ingo Schwarze2017-06-241-1/+40
| | | | inspired by mdoclint
* in the base system, suggest leaving .Os blank; inspired by mdoclintIngo Schwarze2017-06-241-1/+8
|
* Split -Wstyle into -Wstyle and the even lower -Wbase, and addIngo Schwarze2017-06-241-15/+21
| | | | | | | | | | | | | | | -Wopenbsd and -Wnetbsd to check conventions for the base system of a specific operating system. Mark operating system specific messages with "(OpenBSD)" at the end. Please use just "-Tlint" to check base system manuals (defaulting to -Wall, which is now -Wbase), but prefer "-Tlint -Wstyle" for the manuals of portable software projects you maintain that are not part of OpenBSD base, to avoid bogus recommendations about base system conventions that do not apply. Issue originally reported by semarie@, solution using an idea from tedu@, discussed with jmc@ and jca@.
* style message about missing RCS ids; inspired by mdoclintIngo Schwarze2017-06-171-2/+5
|
* ooops, fix a glitch in the previous commit...Ingo Schwarze2017-06-111-2/+2
|
* Style message about legacy man(7) date format in mdoc(7) documentsIngo Schwarze2017-06-111-6/+28
| | | | | and operating system dependent messages about missing or unexpected Mdocdate; inspired by mdoclint(1).
* style message about missing .Fn markup; inspired by mdoclintIngo Schwarze2017-06-111-8/+25
|
* Do not issue the message "no blank before trailing delimiter" for .No.Ingo Schwarze2017-06-111-4/+4
| | | | | | | In practice, that message only matters inside .Bf, and even there, it can occasionally be a false positive. In all other cases, it usually is a false positive, so it is better to drop it outright. Suggested by jmc@.
* Reduce false positives for the "no blank before trailing delimiter" message.Ingo Schwarze2017-06-101-3/+76
| | | | This brings us down to one false positive for about every 18 pages.
* style message about missing blank before trailing delimiter;Ingo Schwarze2017-06-101-39/+75
| | | | inspired by mdoclint(1), and jmc@ considers it useful
* warning about unknown .Lb arguments; inspired by mdoclint(1)Ingo Schwarze2017-06-081-1/+4
|
* style checks related to .Er; inspired by mdoclint(1)Ingo Schwarze2017-06-071-3/+37
|
* STYLE message about full stop at the end of .Nd; inspired by mdoclint(1)Ingo Schwarze2017-06-011-1/+7
|
* STYLE message about missing use of Ox/Nx/Fx/Dx; OK jmc@ wiz@Ingo Schwarze2017-05-311-1/+33
|
* STYLE message about useless macros we don't want (Bt Tn Ud);Ingo Schwarze2017-05-301-2/+14
| | | | not a WARNING because they don't endanger portability
* warn about punctuation between .Xr and .Rs in SEE ALSO;Ingo Schwarze2017-05-141-2/+2
| | | | inspired by mdoclint
* Move .sp to the roff modules. Enough infrastructure is in placeIngo Schwarze2017-05-051-5/+5
| | | | now that this actually saves code: -70 LOC.
* move .ll to the roff modulesIngo Schwarze2017-05-051-2/+1
|
* Move handling of the roff(7) .ft request from the man(7)Ingo Schwarze2017-05-051-2/+3
| | | | | modules to the new roff(7) modules. As a side effect, mdoc(7) now handles .ft, too. Of course, do not use that.
* Parser reorg:Ingo Schwarze2017-05-041-7/+18
| | | | | Generate the first node on the roff level: .br Fix some column numbers in diagnostic messages while here.
* Parser unification: use nice ohashes for all three request and macro tables;Ingo Schwarze2017-04-291-8/+8
| | | | no functional change, minus two source files, minus 200 lines of code.
* Delete .Pp right before the first .Sh and right before any .Ss,Ingo Schwarze2017-04-281-1/+4
| | | | and warn about it; mdoclint(1) does so, and it makes sense.
* Continue parser unification:Ingo Schwarze2017-04-241-42/+37
| | | | | | | | * 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[].
* Using .Nd only makes sense in the NAME section.Ingo Schwarze2017-03-061-1/+5
| | | | | Warn if that macro occurs elsewhere. Triggered by a question from Dag-Erling Smoergrav <des @ FreeBSD>.
* The .Nm macro does not only use the default name when it has noIngo Schwarze2017-02-061-1/+11
| | | | | | | | | | argument, but also when the first argument is a child macro. Arcane issue found in the FreeBSD cxgbetool(8) manual that Baptiste Daroussin <bapt at FreeBSD> sent me long ago for a different reason. While solving this, switch to the new technique of doing text production in the validator, reducing code duplication in the formatters, which also makes -Ttree output clearer.
* Do text production for .Bt, .Ex, .Rv, .Ud at the validation stageIngo Schwarze2017-01-111-82/+188
| | | | | | | | | rather than in the formatters. Use NODE_NOSRC flag for .Lb and NODE_NOSRC and NODE_NOPRT for .St. Results in a more rigorous syntax tree and in 135 lines less code. This work was triggered by a question from Abhinav Upadhyay <er dot abhinav dot upadhyay at gmail dot com> (NetBSD) on discuss@.
* Use new NODE_NOSRC and NODE_NOPRT flags for .Bx and .At.Ingo Schwarze2017-01-101-22/+46
| | | | More rigorous AST and 40 lines less code.
* For the .Ux/.Ox family of macros, do text production at the validationIngo Schwarze2017-01-101-7/+43
| | | | | stage rather than in each and every individual formatter, using the new NODE_NOSRC flag. More rigorous and also ten lines less code.
* unify names of AST node flags; no change of cpp outputIngo Schwarze2017-01-101-4/+4
|
* Introduce flags NODE_NOSRC and NODE_NOPRT for AST nodes.Ingo Schwarze2017-01-101-15/+16
| | | | | | | | | 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.
* Tolerate bare tabs in SYNOPSIS .Cd for now.Ingo Schwarze2017-01-081-2/+3
| | | | | | | It's used in half a dozen pages. Even though i have been thinking about it for years, i still can't suggest anything better. The false positives are annoying.
* Stricter validation of the NAME section, in particular:Ingo Schwarze2017-01-081-11/+19
| | | | | | | - require a comma between names - reject all other text nodes - reject all empty Nm below NAME, not only in the leading position - reject Nm after Nd
* Make the second, section number argument of .Xr mandatory.Ingo Schwarze2016-12-281-3/+19
| | | | | | In fact, we have been requiring it for many years. The only reason to not warn when it was missing was excessive traditionalism - it was optional in 4.4BSD.
* Delete complicated code dealing with .Bl -tag without -width,Ingo Schwarze2016-10-091-82/+1
| | | | | | | | | | | | and just let it default to -width 6n, which agrees with the traditional -width Ds that is still in widespread use. I just pushed a patch upstream to GNU roff that does the same for groff_mdoc(7). Before, groff contained code that was even more complicated than mandoc, but both resulted in quite different user-visible output. Now, both agree, and output is nicer for both. Useless complication noticed by Carsten Kunze (Heirloom roff).
* If a column list starts with implicit rows (that is, rows without .It)Ingo Schwarze2016-08-201-6/+34
| | | | | | and roff-level nodes (e.g. tbl or eqn) follow, don't run into an assertion. Instead, wrap the roff-level nodes in their own row. Issue found by tb@ with afl(1).
* oops, fix stupid typo in previousIngo Schwarze2016-08-111-2/+3
|
* If a .Bd display is on the one hand doomed to be deleted becauseIngo Schwarze2016-08-111-4/+5
| | | | | | | it has no type, but is on the other hand breaking another block, delete its end marker as well, or the end marker may remain behind as an orphan, triggering an assertion in the terminal formatter. Problem found by tb@ with afl(1).
* Don't deref NULL if the only child of the first .Sh is an emptyIngo Schwarze2016-08-101-5/+8
| | | | | | in-line macro, and don't printf("%s", NULL) if the first child of the first .Sh is a macro; again found by tb@ with afl(1). (No, you should never use macros in any .Sh at all, please.)
* Don't printf("%s", NULL) if .It has a macro as an argumentIngo Schwarze2016-08-101-3/+4
| | | | | in a list of a type where items don't takes arguments. Issue found by tb@ with afl(1).
* When validating a .Bl list that defaults to -item for want of a type,Ingo Schwarze2016-08-101-1/+2
| | | | | don't let a subsequent -width access mdoc_argnames[] out of bounds. Found by tb@ with afl(1).
* fix printf("%s", NULL);Ingo Schwarze2016-08-091-4/+5
| | | | found while investigating an unrelated bug report from jsg@
* Delete the redundant "nchild" member of struct roff_node, replacingIngo Schwarze2016-01-081-14/+12
| | | | | | | | most uses by one, a few by two pointer checks, and only one by a tiny loop - not only making data smaller, but code shorter as well. This gets rid of an implicit invariant that confused both static analysis tools and human auditors. No functional change.