summaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_macro.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-05-30 21:50:23 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-05-30 21:50:23 +0000
commitb8ca66ed11088edca84601f2bbe21a94cd5392ef (patch)
treef066d640a226ddf72871f0892c77a93c7bb9a247 /mdoc_macro.c
parentd2821fc8969b316c2166386b58e1463cd1e904d5 (diff)
downloadmandoc-b8ca66ed11088edca84601f2bbe21a94cd5392ef.tar.gz
mandoc-b8ca66ed11088edca84601f2bbe21a94cd5392ef.tar.zst
mandoc-b8ca66ed11088edca84601f2bbe21a94cd5392ef.zip
Final word on lac/ac. Document flow as it relates to phrasing, as I'll
be changing this around and want a record in CVS of what was happening beforehand.
Diffstat (limited to 'mdoc_macro.c')
-rw-r--r--mdoc_macro.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/mdoc_macro.c b/mdoc_macro.c
index 9867f01e..bbbde85c 100644
--- a/mdoc_macro.c
+++ b/mdoc_macro.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_macro.c,v 1.72 2010/05/30 21:41:46 kristaps Exp $ */
+/* $Id: mdoc_macro.c,v 1.73 2010/05/30 21:50:23 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -1002,11 +1002,11 @@ blk_full(MACRO_PROT_ARGS)
}
ac = ARGS_ERROR;
- lac = ARGS_PHRASE;
for ( ; ; ) {
la = *pos;
- lac = ac;
+ /* Initialise last-phrase-type with ARGS_PHRASE. */
+ lac = ARGS_ERROR == ac ? ARGS_PHRASE : ac;
ac = mdoc_args(m, line, pos, buf, tok, &p);
if (ARGS_ERROR == ac)
@@ -1014,7 +1014,10 @@ blk_full(MACRO_PROT_ARGS)
if (ARGS_EOLN == ac)
break;
- /* Don't emit leading punct. for phrases. */
+ /*
+ * Emit leading punctuation (i.e., punctuation before
+ * the MDOC_HEAD) for non-phrase types.
+ */
if (NULL == head &&
ARGS_PEND != ac &&
@@ -1027,7 +1030,10 @@ blk_full(MACRO_PROT_ARGS)
continue;
}
- /* Always re-open head for phrases. */
+ /*
+ * Open a head if one hasn't been opened. Re-open head
+ * for phrases.
+ */
if (NULL == head ||
ARGS_PEND == ac ||
@@ -1041,6 +1047,11 @@ blk_full(MACRO_PROT_ARGS)
if (ARGS_PHRASE == ac ||
ARGS_PEND == ac ||
ARGS_PPHRASE == ac) {
+ /*
+ * 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)
@@ -1054,6 +1065,8 @@ blk_full(MACRO_PROT_ARGS)
m->flags &= ~MDOC_PPHRASE;
+ /* Close out active phrase. */
+
if ( ! rew_sub(MDOC_HEAD, m, tok, line, ppos))
return(0);
continue;