aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_macro.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-05-30 22:56:02 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-05-30 22:56:02 +0000
commitc13027734e9d36c96b4fd039e21c3112330c80c1 (patch)
tree68a38c78005cc5fa2efaaa78bb7dcfe23b7de716 /mdoc_macro.c
parentb8ca66ed11088edca84601f2bbe21a94cd5392ef (diff)
downloadmandoc-c13027734e9d36c96b4fd039e21c3112330c80c1.tar.gz
mandoc-c13027734e9d36c96b4fd039e21c3112330c80c1.tar.zst
mandoc-c13027734e9d36c96b4fd039e21c3112330c80c1.zip
Migrate `Bl -column' phrases to be MDOC_BODY instead of MDOC_HEAD. This
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.
Diffstat (limited to 'mdoc_macro.c')
-rw-r--r--mdoc_macro.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/mdoc_macro.c b/mdoc_macro.c
index bbbde85c..4d52987c 100644
--- a/mdoc_macro.c
+++ b/mdoc_macro.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_macro.c,v 1.73 2010/05/30 21:50:23 kristaps Exp $ */
+/* $Id: mdoc_macro.c,v 1.74 2010/05/30 22:56:02 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -937,6 +937,7 @@ blk_full(MACRO_PROT_ARGS)
#ifdef UGLY
struct mdoc_node *n;
#endif
+ enum mdoc_type mtt;
enum mdoct ntok;
enum margserr ac, lac;
enum margverr av;
@@ -1030,15 +1031,9 @@ blk_full(MACRO_PROT_ARGS)
continue;
}
- /*
- * Open a head if one hasn't been opened. Re-open head
- * for phrases.
- */
+ /* Open a head if one hasn't been opened. */
- if (NULL == head ||
- ARGS_PEND == ac ||
- ARGS_PHRASE == ac ||
- ARGS_PPHRASE == ac) {
+ if (NULL == head) {
if ( ! mdoc_head_alloc(m, line, ppos, tok))
return(0);
head = m->last;
@@ -1048,10 +1043,26 @@ blk_full(MACRO_PROT_ARGS)
ARGS_PEND == ac ||
ARGS_PPHRASE == ac) {
/*
+ * If we haven't opened a body yet, rewind the
+ * head; if we have, rewind that instead.
+ */
+
+ mtt = body ? MDOC_BODY : MDOC_HEAD;
+ if ( ! rew_sub(mtt, m, tok, line, ppos))
+ return(0);
+
+ /* Then allocate our body context. */
+
+ if ( ! mdoc_body_alloc(m, line, ppos, tok))
+ return(0);
+ body = m->last;
+
+ /*
* Process phrases: set whether we're in a
* partial-phrase (this effects line handling)
* then call down into the phrase parser.
*/
+
if (ARGS_PPHRASE == ac)
m->flags |= MDOC_PPHRASE;
if (ARGS_PEND == ac && ARGS_PPHRASE == lac)
@@ -1064,11 +1075,6 @@ blk_full(MACRO_PROT_ARGS)
return(0);
m->flags &= ~MDOC_PPHRASE;
-
- /* Close out active phrase. */
-
- if ( ! rew_sub(MDOC_HEAD, m, tok, line, ppos))
- return(0);
continue;
}