summaryrefslogtreecommitdiffstats
path: root/mdoc_validate.c
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* Stash `Bf' parameters into struct mdoc_bf.Kristaps Dzonsons2010-07-021-22/+56
|
* Make struct_bl and struct_bd into pointers. This removes the need to doKristaps Dzonsons2010-07-011-52/+65
| | | | | | | | | | | copying on internals after modification. Even more importantly, if an ENDBODY token is provided, it would have been impossible for post-change copying of the data to take place in the BLOCK. This allows it to happen by dint of pointers. Also did some bikeshedding in mdoc_term.c: checking against enum type and explicitly casting to the "post" function to void. This is for my own readability.
* Prevent validator from puking on ENDBODY `Bl' nodes.Kristaps Dzonsons2010-07-011-0/+2
|
* Notes: this must be done later. \b in the input will cause havoc.Kristaps Dzonsons2010-06-281-0/+5
|
* minor .Bk fixes:Ingo Schwarze2010-06-271-3/+3
| | | | | | | | * do not print invalid arguments verbatim (no groffs prints them, either) * do not trigger TERMP_PREKEEP twice * do not die from invlid arguments (groff won't die, either) * continue to ignore even valid arguments (just like groff) ok kristaps@ on the previous version, before removing my last bug ;)
* Allow registers to be unset. Implement and document the `.nr nS val'.Kristaps Dzonsons2010-06-271-0/+2
|
* Allow -width for lists to be cached in mdoc_bl. This requires someKristaps Dzonsons2010-06-131-11/+13
| | | | | | trickery because widths may be on-the-fly recalculated. I don't like how these are split between mdoc_action.c and mdoc_validate.c, but for the time being, it'll do.
* Cached `Bl -offset' into mdoc_bl. Removed erroneous "-offset defaultsKristaps Dzonsons2010-06-121-6/+15
| | | | | to 6n if no value is specified" and added regression tests for `Bl' testing against the empty -offset argument.
* Moved `Bl -compact' into cached data. This allowed the removal ofKristaps Dzonsons2010-06-121-12/+13
| | | | scanning the argv list in print_bvspace(), and thus the parent pointer.
* `Bl' is now using a struct instead of a single enum mdoc_list for itsKristaps Dzonsons2010-06-121-12/+13
| | | | cached values. You can probably guess where this is going.
* Removed stipulation that an empty `Bd -offset' will default to 6n. NotKristaps Dzonsons2010-06-121-17/+2
| | | | | | | sure where this came about. Added regression tests to convince myself that this is so. Also consolidated COMPATIBILITY notes regarding `Bd'. Added COMPATIBILITY note to the effect that old groff pukes on `Bd -compact -ragged' (regression test will fail on old groff).
* Cache all of `Bd's resolved arguments into mdoc_bd, which is stashed inKristaps Dzonsons2010-06-121-12/+59
| | | | | | the "data" union in mdoc_node. Allows me to remove some ugly loops in the front-end and duplicate tests in mdoc_action.c. Add a regression test to make sure we're not doing anything bad (more to come).
* Added enum mdoc_disp (similar to enum mdoc_list). Display types are nowKristaps Dzonsons2010-06-121-20/+42
| | | | | | | | | | | only calculated once in mdoc_validate.c. Noted that `Bd -file xxx' is not supported: it now raises a fatal warning. This is noted in mdoc.7. Empty `Bd' now defaults to LIST_ragged, which is not quite what groff does, but close enough (gross just throws away the `Bd' and gets upset when it encounters an `Ed').
* Squash bug noted by Ulrich Spoerlein where "-" were being converted toKristaps Dzonsons2010-06-091-10/+7
| | | | | | | | | ASCII_HYPH, as per normal, but were screwing up mandoc_special(). Fixed by making mandoc_special() first check isspace() instead of ! isgraph(), then normalise its string as it passes out. This require de-constifying some validation routines not already de-constified (those in libman), but that's ok, because I'd like to be pushing actions into validation routines to save on space and redundant calculations.
* Consolidated list processing to a single loop in mdoc_validate.c. ThisKristaps Dzonsons2010-06-031-63/+105
| | | | | | | | | | relieves having to repeat running over the argument list in mdoc_action.c and mdoc_validate.c. Default to LIST_item for type-less lists (groff technically doesn't do this: it just ignores the `It' lines altogether). Make MANDOC_LISTTYPE be a recoverable error.
* Cleanup post_bl_head() to use enum mdoc_list (avoid traversing thatKristaps Dzonsons2010-05-311-10/+13
| | | | | | | | list). Reverted MANDOC_COLUMNS to be a bad-bad syntax error: we don't, and apparently never have, allowed mixing of -column syntaxes. This would have segfaulted if encountered.
* Clean up the validation code for `It' macros: use enum mdoc_listKristaps Dzonsons2010-05-311-71/+39
| | | | | instead of iterating over arguments and only scan with `-column', which needs the count of arguments.