summaryrefslogtreecommitdiffstats
path: root/mdoc_validate.c
Commit message (Collapse)AuthorAgeFilesLines
* If `Ns' is specified on its own line, it should be ignored. This isKristaps Dzonsons2011-02-021-1/+12
| | | | | shitty groff behaviour. Do the same, but raise a warning to this effect. This from a TODO noted by schwarze@.
* Push capitalisation of `Bx' second argument into validator, where it belongs.Kristaps Dzonsons2011-01-251-1/+21
|
* If %B is specified, quote %T. Noted by schwarze@ in the TODO.Kristaps Dzonsons2011-01-251-2/+2
|
* Check argument count validation for all in_line() macros.Ingo Schwarze2011-01-221-36/+20
| | | | | | | | Most empty in_line() macros are already removed by the parser, so there is no need to check again in mdoc_validate.c. This also downgrades almost all remaining argument count issues from ERROR to WARNING. ok kristaps@
* Partial cleanup of argument count validation in mdoc(7):Ingo Schwarze2011-01-031-65/+67
| | | | | | | | | | | | * Do not segfault on empty .Db, .Rs, .Sm, and .St. * Let check_count() really throw the requested level, not always ERROR. * Downgrade most bad argument counts from ERROR to WARNING. * And some related internal cleanup. Looks fine to kristaps@. Note that the macros using eerr_ge1() still need to be checked at a later time; but as all the others are done, let's use what we already have.
* Add table processing structures to -mdoc. This consists of anKristaps Dzonsons2011-01-011-3/+16
| | | | | | external-facing function mdoc_addspan(), then various bits to prohibit printing and scanning (this requires some if's to be converted into switch's).
* Implement schwarze@'s much more elegant version of my %T/%J fix.Kristaps Dzonsons2010-12-251-16/+3
|
* Specifying both %T and %J in an `Rs' block causes the title to be quotedKristaps Dzonsons2010-12-251-1/+16
| | | | | instead of underlined. This only happens in -Tascii, as -T[x]html both underlines and italicises.
* As per schwarze@'s suggestions, roll back the refcount structure inKristaps Dzonsons2010-12-241-78/+58
| | | | | | | | favour of a simpler shim for normalised data in the node allocation and free routines. This removes the need to bump and copy references within validator handlers, removes a pointer redirect, and also kills the refcount structure itself. Data is assumed to "live" either in a MDOC_BLOCK or MDOC_ELEM and is copied accordingly.
* At the beginning of .Bl, .Sm is allowed,Ingo Schwarze2010-12-221-3/+5
| | | | | and .Lp should cause a warning, not an error. "I don't suppose I mind this." kristaps@
* Implement reference-counted version of original union mdoc_data. ThisKristaps Dzonsons2010-12-221-74/+76
| | | | | | | simplifies clean-up and allows for more types without extra hassle. Also made in-line literal types in -T[x]html use CODE instead of SPAN to match how literal blocks use PRE.
* Migrate `An' to use a pointer in its data, like everybody else. This isKristaps Dzonsons2010-12-161-4/+7
| | | | | the first step to having a simpler ref-counted system for "data" associated with a node.
* Back out last: apparently `Bl', `It', and `Pp' need a little bit moreKristaps Dzonsons2010-12-161-17/+2
| | | | study to see exactly what's legal and what's not.
* Allow `It' to have a trailing paragraph if the surrounding list is inKristaps Dzonsons2010-12-161-2/+17
| | | | compact mode.
* First, make `Pp' (next to `Sm') be allowed as the first element of aKristaps Dzonsons2010-12-161-13/+15
| | | | | | | | | | | `Bl' (before any `It' have been invoked). Next, have the existence of either macro raise a warning, as it's technically not legal according to mdoc.7. Second, delete any `Pp' as the first element of a `Bl' (i.e., before an `It') ONLY when -compact has not been specified. This matches with the latest version of groff. This deletion happens prior to the above check, so double-warnings will not be issued.
* Add a "last child" member of struct mdoc_node.Kristaps Dzonsons2010-12-151-6/+26
| | | | | | | Remove `Pp' or `Lp' if it is the FIRST or LAST child of an `Sh' or `Sh' body. Make "skipping paragraph" be an error, not a warning, as information (an invoked macro) is ignored.
* Allow quote macros (`Op', `Aq', `Bq', `Dq', `Pq', `Ql', `Qq', `Sq', andKristaps Dzonsons2010-12-091-9/+9
| | | | | | | | | `Brq') to have zero arguments without warning. This makes sense because the multi-line quote macros (`Oo/Oc' etc.) allow zero children anyway. Furthermore, the documentation doesn't state that they're required to have children. Originally reported by Alex Kozlov, thanks!
* Remove repeat notification of -width omission. From a patch by schwarze@.Kristaps Dzonsons2010-12-051-6/+1
|
* Remove long-standing FIXME regarding the consolidation of WIDTHARG andKristaps Dzonsons2010-12-051-3/+2
| | | | NOARGV warnings. From patch by schwarze@.
* Merge schwarze@'s patch to allow uname() to fail without causing an exit.Kristaps Dzonsons2010-12-051-3/+6
|
* Merge schwarze@'s changes allowing nested displays. Tweak the patch byKristaps Dzonsons2010-12-051-10/+6
| | | | | | | making sure output doesn't add a superfluous newline with the nested displays. Also add a COMPATIBILITY note. Rename a macro (DATESIZ) to be in line with OpenBSD (DATESIZE).
* Fixed a goddamn subtle error causing MDOC_LITERAL to remain set after aKristaps Dzonsons2010-12-011-1/+1
| | | | call to `Dl' or `Bd -literal' or unfilled.
* Simplify the many if ( ! mdoc_nmsg()) return(0) etc. calls with just theKristaps Dzonsons2010-11-301-168/+157
| | | | | | | | | | error printing, as this is superseded by exit_status in main.c. Make check_argv() and check_text() return void. Make MDOC_Std test in check_argv() to pre_std(). Re-write post_root() to check more conditions before returning.
* Moved all prologue actions from mdoc_action.c into mdoc_validate.c. TheKristaps Dzonsons2010-11-301-74/+294
| | | | file is now ready for removal.
* Move post_bl() and subfunctions from mdoc_action.c into mdoc_validate.c.Kristaps Dzonsons2010-11-301-0/+155
|
* Move -column list validation and normal-formisation from mdoc_action.cKristaps Dzonsons2010-11-301-11/+56
| | | | into mdoc_validate.c.
* Migrate `Nm' and `Pa' handling from mdoc_action.c into mdoc_validate.c.Kristaps Dzonsons2010-11-291-6/+37
| | | | Document that `Pa' is replaced by a tilde, just like `Mt'.
* Remove left-over rsord[] in mdoc_actions.c.Kristaps Dzonsons2010-11-291-10/+73
| | | | | | | | | Remove MANDOCERR_BADLIB (not used). Moved `St' handling from mdoc_action.c into mdoc_validate.c. Moved relevant MDOC_LITERAL macros (`Dl', `Bd' subtypes) from mdoc_action.c into mdoc_validate.c.
* Move `Lb' handling from mdoc_action.c into mdoc_validate.c.Kristaps Dzonsons2010-11-291-4/+25
|
* Move `At' handling from mdoc_action.c into mdoc_validate.c.Kristaps Dzonsons2010-11-291-5/+35
|
* Move `Sh' validation from mdoc_action.c. into mdoc_validate.c.Kristaps Dzonsons2010-11-291-27/+45
| | | | | Surprisingly, both functions were doing pretty much the same thing. Make sure that the changes incorporate the union of both.
* Clarifying role of pre_pp (now pre_par), which was confusing me due toKristaps Dzonsons2010-11-291-7/+9
| | | | | its name. Added some more documentation just for clarity's sake. No functional change.
* Move `Mt', `Ar', and `Li' handling from mdoc_action.c into mdoc_validate.c.Kristaps Dzonsons2010-11-291-4/+46
| | | | | | | | Clarify that `Mt' gets a default `~' (as per groff 1.20) and document it in mdoc.7. Made `Lk' be removed in mdoc_macro.c if it has no arguments. This fixes segfaults in mdoc_{term,html}.c that nobody's managed to raise yet.
* Migrate action for `Rs' into mdoc_validate.c.Kristaps Dzonsons2010-11-291-34/+103
| | | | | | Remove superfluous in-line order_rs function. Merge `Rs' validations {BLOCK, BODY} -> {BODY}. Make invalid children of `Rs' raise an error but otherwise be allowed.
* Use proper error for `An' multiple arguments.Kristaps Dzonsons2010-10-111-4/+5
| | | | Making IGNARGV be an ERROR, not a WARNING, as information is lost.
* Initial commit of cleaned-up validation code for -mdoc. Remove thoseKristaps Dzonsons2010-10-111-81/+123
| | | | | ugly CPP macros in favour of real functions. Enumerate areas of short- term future cleanup, too.
* Merge from OpenBSD right after 1.10.6; now back to full sync.Ingo Schwarze2010-09-271-1/+1
| | | | | | | | | | * mdoc.c: blank lines outside literal mode are more similar to .sp than .Pp * backslashes do not terminate macros; partial revert of mdoc.c 1.164; the intention of that commit is fully achieved in roff.c * mdoc_term.c: no need to list the same prototype twice * mdoc_validate.c: drop .Pp before .sp just like .Pp before .Pp * fix off-by-one found by jsg@ with parfait, OpenBSD term_ps.c 1.12 ok kristaps@
* Consider both `Lp' and `Pp' when stripping prior paragraph marks.Kristaps Dzonsons2010-09-271-1/+6
|
* Ignore double-`Pp' and `Pp' before `Bd' and `Bl' (unless -compact isKristaps Dzonsons2010-09-271-3/+23
| | | | specified).
* Made -mdoc `Pp', `Lp', and `br' not FATAL when having arguments.Kristaps Dzonsons2010-08-291-3/+3
|
* Implement a simple, consistent user interface for error handling.Ingo Schwarze2010-08-201-6/+2
| | | | | | | | | | | | | | | | | We now have sufficient practical experience to know what we want, so this is intended to be final: - provide -Wlevel (warning, error or fatal) to select what you care about - provide -Wstop to stop after parsing a file with warnings you care about - provide consistent exit status codes for those warnings you care about - fully document what warnings, errors and fatal errors mean - remove all other cruft from the user interface, less is more: - remove all -f knobs along with the whole -f option - remove the old -Werror because calling warnings "fatal" is silly - always finish parsing each file, unless fatal errors prevent that This commit also includes a couple of related simplifications behind the scenes regarding error handling. Feedback and OK kristaps@; Joerg Sonnenberger (NetBSD) and Sascha Wildner (DragonFly BSD) agree with the general direction.
* Note that `Dd' can be empty. This found following a thread on discuss@Kristaps Dzonsons2010-07-261-1/+1
| | | | started by Sascha Wildner, 07/25/2010 06:30 AM.
* Finally make mdoc argv CPP-defines into a proper enum.Kristaps Dzonsons2010-07-211-1/+3
|
* Strip non-graphable input characters from input. The manualsKristaps Dzonsons2010-07-201-19/+19
| | | | | | | | | specifically say that this is not allowed, and were it allowed, output would be inconsistent across output media (-Tps will puke, non-your-charset terminals will puke, etc.). With this done, simplify check_text() to only check escapes and for tabs. Add in a new tab warning, too.
* Remove some FIXMEs: `Ms' accepts arbitrary text, so it can't/shouldn'tKristaps Dzonsons2010-07-191-1/+0
| | | | | | be converted into a symbol. The `Pp' issue has also been fixed.
* correct lots of copyright notices;Ingo Schwarze2010-07-131-1/+1
| | | | ok kristaps@
* Cache column sizes and char pointer into mdoc_bl. Finally get rid ofKristaps Dzonsons2010-07-041-14/+11
| | | | the loops here and there to track down the MDOC_Column arguments.
* Not only for -tag lists, but for -hang, -ohang, -inset, -diag,Ingo Schwarze2010-07-021-6/+3
| | | | | | | and -item list as well, empty bodies are OK, they do not even warrant a warning, much less the error they were throwing. According to kristaps, joerg@ also brought this up some time ago. ok kristaps@ jmc@
* Cached `An' arguments in struct mdoc_an. Note that this isn't aKristaps Dzonsons2010-07-021-14/+19
| | | | pointer like the other data members, as there's no need to copy it around.
* Fix: was checking HEAD for arguments.Kristaps Dzonsons2010-07-021-4/+6
|