summaryrefslogtreecommitdiffstats
path: root/mdoc_macro.c
Commit message (Collapse)AuthorAgeFilesLines
...
* libmdoc.h and libman.h were including mdoc.h and man.h, respectively.Kristaps Dzonsons2011-03-221-0/+1
| | | | | Don't have them do that (includes in header files = faugh), and have individual files directly include these files.
* Move mandoc_isdelim() back into libmdoc.h. This fixes an unreportedKristaps Dzonsons2011-03-221-24/+47
| | | | | | | | | error where (1) -man pages were punctuating delimiters (e.g., `.B a ;') and where (2) standalone punctuation in -mdoc or -man (e.g., ";" on its own line) would also be punctuated. This introduces a small amount of complexity of mdoc_{html,term}.c must manage their own spacing with running print_word() or print_text(). The check for delimiting now happens in mdoc_macro.c's dword().
* Consolidate messages. Have all parse-time messages (in libmdoc,Kristaps Dzonsons2011-03-201-7/+8
| | | | | | | | | libroff, etc., etc.) route into mandoc_msg() and mandoc_vmsg(), for the time being in libmandoc.h. This requires struct mparse to be passed into the allocation routines instead of mandocmsg and a void pointer. Then, move some of the functionality of the old mmsg() into read.c's mparse_mmsg() (check against wlevel and setting of file_status) and use main.c's mmsg() as simply a printing tool.
* Clean-up in libmdoc: fix last checks for mdoc_*msg return value, thenKristaps Dzonsons2011-03-171-10/+9
| | | | | make mdoc_vmsg not return an int. libmdoc is now completely clean of return-value checks from the message subsystem.
* Move mdoc_isdelim() into mandoc.h as mandoc_isdelim(). This allows theKristaps Dzonsons2011-03-171-7/+7
| | | | | | removal of manual delimiter checks in html.c and term.c. Finally, add the escaped period as a closing delimiter, removing a TODO to this effect.
* Have `Bx' accept two arguments, not just one, and join these argumentsKristaps Dzonsons2011-01-251-0/+2
| | | | with "xxBSD-yy"
* Incorporate same fix for -man post-validation deletion of nodes. ThisKristaps Dzonsons2011-01-121-2/+9
| | | | isn't known to cause any problems, but better safe than sorry.
* Add a "last child" member of struct mdoc_node.Kristaps Dzonsons2010-12-151-0/+3
| | | | | | | 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.
* Merge schwarze@'s relaxation of scope-breaking rules: allow implicitKristaps Dzonsons2010-12-061-21/+21
| | | | ending of scopes and drop stray scope-endings.
* mdoc_action.c is no more. Attic it and remove it from the Makefile.Kristaps Dzonsons2010-11-301-10/+2
| | | | | Remove references to MDOC_ACTED (it was only assertions) and the pre- and post-action functions.
* Move `Mt', `Ar', and `Li' handling from mdoc_action.c into mdoc_validate.c.Kristaps Dzonsons2010-11-291-1/+1
| | | | | | | | 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.
* * need a space before .No even if it starts with a closing delimiterIngo Schwarze2010-10-011-2/+2
| | | | | | | * slightly simplify .Pf *_IGNDELIM code, and share part of it with .No * do not let opening delimiters fall out of the front of .Ns (from kristaps@) This fixes a few spacing issues in csh(1) and ksh(1). OK kristaps@
* If an explicit scope is still open at the end of an input file,Ingo Schwarze2010-09-261-8/+4
| | | | | | | | | | report an ERROR: We can still render the page by just closing the open scope, but it is likely that information will be missing or document structure mangled. Before, man(7) only reported a WARNING (which is dangerous because we cannot be sure rendering is correct) and mdoc(7) ran into FATAL (which is too drastic, there is no reason not to show what we have). "looks good" kristaps@
* Text ending in a full stop, exclamation mark or question markIngo Schwarze2010-07-181-2/+2
| | | | | | | | | | | | | | | | | | should not flag the end of a sentence if: 1) The punctuation is followed by closing delimiters and not preceded by alphanumeric characters, like in "There is no full stop (.) in this sentence" or 2) The punctuation is a child of a macro and not preceded by alphanumeric characters, like in "There is no full stop .Pq \&. in this sentence" "looks fine" to kristaps@; tested by jmc@ and sobrado@
* Assert my copyright, making it explicit that i'm granting the same licenseIngo Schwarze2010-07-041-1/+2
| | | | | on those parts of the code and text that i have written as Kristaps is. "fine with me" kristaps@
* Lint fixes.Kristaps Dzonsons2010-07-021-1/+1
|
* In the mdoc(7) parser, inspect roff registers early such that all partsIngo Schwarze2010-07-011-1/+4
| | | | | | | | | | | | of the parser can use the resulting cues. In particular, this allows to use .nr nS to force SYNOPSIS-style .Nm indentation outside the SYNOPSIS as needed by ifconfig(8). To actually make this useable, .Pp must rewind .Nm, or the rest of the section would end up indented. Implement a quick hack for now, a generic solution can be designed later. ok kristaps@ and tested by sobrado@
* Correct handling of trailing punctuation in MDOC_DELIM blk_full HEADs.Ingo Schwarze2010-07-011-0/+3
| | | | | | | The bug was uncovered by SYNOPSIS .Nm as this happened to be the first block with this particular combination of properties. Found the hard way by kristaps@ in NetBSD gcc-contrib(1), fix by me.
* Improve .Nm indentation in the SYNOPSIS;Ingo Schwarze2010-07-011-10/+19
| | | | | | | kristaps@ will do the missing HTML part soon. "looks nicer" jmc@ "seems perfect to me" sobrado@ "slap it in" kristaps@
* p->end is an enum: treat it as such.Kristaps Dzonsons2010-07-011-2/+2
|
* Closing of full blocks (Bd Bf Bk Bl It Fo Nd Rs Sh Ss) may never beIngo Schwarze2010-06-301-3/+42
| | | | | | | | | | delayed: It must either succeed right away or fail outright. As noticed by Kristaps, neglecting to fail properly when required could make invalid input screw up the syntax tree and ultimately trigger assertions in other, unrelated parts of the program. This fix tested by and OK by kristaps@. While here, comment the rather tricky function rew_dohalt(). This function will probably need more tweaks later on.
* fix a typo in the function declaration;Ingo Schwarze2010-06-291-1/+1
| | | | | seems like gcc3 didn't catch it :-( thanks to thib@ and kristaps@ for reporting
* Considerably simplify block rewind rules; no functional change intended.Ingo Schwarze2010-06-291-206/+69
| | | | | | | | | | * Let rew_alt() always succeed, obsoleting tons of case statements. * Merge rew_dobreak() into rew_dohalt(). * Encode all rewinding cases uniformly in terms of "enum rew". Required because i'm too dumb to get SYNOPSIS .Nm rewinding right without cleaning this up first. "get it in" kristaps@
* Support for badly nested blocks, written around the time ofIngo Schwarze2010-06-291-72/+194
| | | | | | | | | | | | | | | | | | | | | | | | | the Rostock mandoc hackathon and tested and polished since, supporting constructs like: .Ao Bo Ac Bc (exp breaking exp) .Aq Bo eol Bc (imp breaking exp) .Ao Bq Ac eol (exp breaking imp) .Ao Bo So Bc Ac Sc (double break, inner before outer) .Ao Bo So Ac Bc Sc (double break, outer before inner) .Ao Bo Ac So Bc Sc (broken breaker) .Ao Bo So Bc Do Ac Sc Dc (broken double breaker) There are still two known issues which are tricky: 1) Breaking two identical explicit blocks (Ao Bo Bo Ac or Aq Bo Bo eol) fails outright, triggering a bogus syntax error. 2) Breaking a block by two identical explicit blocks (Ao Ao Bo Ac Ac Bc or Ao Ao Bq Ac Ac eol) still has a minor rendering error left: "<ao1 <ao2 [bo ac2> ac1> bc]>" should not have the final ">". We can fix these later in the tree, let's not grow this diff too large. "get it in" kristaps@
* Downstream maintainers: this removes UGLY! I don't want divergingKristaps Dzonsons2010-06-271-24/+15
| | | | | | | | | functionality and UGLY works quite well thanks to schwarze@'s careful attention. This also backs out function-prototype changes for struct regset, instead stuffing a pointer to the regset directly into struct mdoc/man/roff.
* Mechanical diff allowing the const struct regset to propogate throughKristaps Dzonsons2010-06-261-15/+18
| | | | libman and libmdoc.
* Churn as I finish email address migration kth.se -> bsd.lv.Kristaps Dzonsons2010-06-191-1/+1
|
* Lint fixes (noops).Kristaps Dzonsons2010-05-311-2/+1
|
* Remove now-superfluous check on `Ta' context.Kristaps Dzonsons2010-05-311-20/+0
|
* Add ability to interpret initial free-form lines as part of a `BlKristaps Dzonsons2010-05-311-1/+11
| | | | | | | | -column' up until the first `It'. This is UGLY and should have all sorts of warnings, and will. On the one hand, it fits with groff's notion of tabs and tab-spaces. On the other hand, it's not really "free-form" text any more. Note that this does not yet accomodate for macros coming on these lines.
* `Ta' scope-checks need to be more specific (until implicit `It' handlingKristaps Dzonsons2010-05-311-1/+4
| | | | comes into play).
* Remove enum mdocargerr from phrase() (unused).Kristaps Dzonsons2010-05-311-22/+96
| | | | | | | | | | | | | | Add `Ta' macro, which is basically a NULL case everywhere but in mdoc_macro.c, where it closes out an existing `It' body scope and opens a new one, then continues parsing as in phrase() (TODO: merge these two?). Fix where scope-breaking was silently just dying instead of printing an error. Fix where trailing `Ta' or tab weren't creating a new MDOC_BODY context. We now support arbitrarily complex `It' contents for `Bl -column'.
* Migrate `Bl -column' phrases to be MDOC_BODY instead of MDOC_HEAD. ThisKristaps Dzonsons2010-05-301-13/+19
| | | | | | | | | | will make it easy for re-entrant parsing of `Ta' macros to fit in with standard closure rules. Added some more regressions for `Bl -column'. Note that one should fail, as documented in the TODO file. Recorded change of AST BNF in mdoc.3.
* Final word on lac/ac. Document flow as it relates to phrasing, as I'llKristaps Dzonsons2010-05-301-4/+17
| | | | | be changing this around and want a record in CVS of what was happening beforehand.
* Obvious fix to last patch: have ARGS_PEND also be flagged for phrase()Kristaps Dzonsons2010-05-301-1/+3
| | | | handling.
* First in several iterative patches in getting complex -column listsKristaps Dzonsons2010-05-301-8/+12
| | | | | | | | supported (which works but is tricky enough that it should be broken down into digestable parts). This simply moves around the propogation of ARGS_PEND into one recognised by phrase(). Added a few regressions for simple -column lists.
* Commit of patch floated on discuss@ a few days ago: if an in_line scopeKristaps Dzonsons2010-05-291-11/+32
| | | | | | | | | | has not been opened and closing punctuation is encountered AND the macro is marked as accepting no-content (or `Li'), then open an empty scope. Added regression tests for `Fl' and `Li' testing this behaviour. Also, squeeze hyph0.in tests into the last characters of each line so that groff doesn't hyphenate and break the test.
* Fixed `Lb' to be in_line (reported by Ulrich Spoerlein).Kristaps Dzonsons2010-05-261-1/+1
| | | | | | | | | Added `Lb' documentation to mdoc.7. Removed harmless but superfluous pre_lb check (was just NULL entries). Added regressions for `Lb' (NOTE that these will only run on new groff, as old groff doesn't support `Lb' at all).
* Enable the unified error/warning enumeration in mandoc.h that'sKristaps Dzonsons2010-05-171-14/+18
| | | | | | | | | | | stringified in main.c. Allow `An' to handle an argument and child (with a warning). Allow `Rv' and `Ex' to work without a prior `Nm' as groff does (with a warning). Allow inconsistent column syntax to only raise a warning.
* Distinguish OPEN, MIDDLE and CLOSE delimiters (using an enum).Ingo Schwarze2010-05-151-10/+12
| | | | | | | Only OPEN are drawn before the beginning of a macro; this is new, before this, MIDDLE ('|') were drawn in front, too. Only CLOSE are pushed after the end of a macro (as before). ok kristaps@
* More EOS: append_delims() fitted with EOS detection, so ANY macro with ↵Kristaps Dzonsons2010-05-151-6/+21
| | | | | | appended delimiters will properly EOS. Fixed mandoc_eos() to accept sentence punctuation followed by close-delim buffers.
* More `Bl -column' dancing: It children also inherit in-phrase flags (noted ↵Kristaps Dzonsons2010-05-151-22/+14
| | | | by Ingo Schwarze).
* Block-implicit macros now up-propogate end-of-sentence spacing. NOTE: GROFF ↵Kristaps Dzonsons2010-05-141-0/+20
| | | | IS NOT SMART ENOUGH TO DO THIS.
* Removed remaining "1 == ppos" invocations.Kristaps Dzonsons2010-05-141-4/+10
|
* Proper handling of quoted tab-separated column lists.Kristaps Dzonsons2010-05-141-11/+6
|
* Lint fix.Kristaps Dzonsons2010-05-131-0/+1
|
* Fixed bug in -Thtml -mdoc where `Lb' would line-break in LIBRARY section.Kristaps Dzonsons2010-05-131-12/+21
| | | | | Fixed assumption that parse-point == 1 equates to beginning of line (false if whitespace separates macro and control character). Fixed line-break for non-first-macro in several SYNOPSIS macros.
* Introduce ARGS_PEND for `It -column' end-of-line special casing.Kristaps Dzonsons2010-05-091-14/+44
| | | | Initial rules for insane `It -column' tabsep handling.
* Lint fixes (type-safety for enums via -cefuh).Kristaps Dzonsons2010-05-081-3/+3
|
* Initial ARGS_PPHRASE (partial phrase) framework.Kristaps Dzonsons2010-05-071-7/+4
| | | | Running tally of changes in index.sgml.