summaryrefslogtreecommitdiffstats
path: root/mdoc_state.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-10-21 23:51:11 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-10-21 23:51:11 +0000
commitddefce3b76421a0191621f40623ba04fd510db65 (patch)
treedd6469438b045980e6a0c684a9d1e5c7ed6ef6c4 /mdoc_state.c
parent3c4f3fa3497c0d1eb3f741840af466708d1a4c86 (diff)
downloadmandoc-ddefce3b76421a0191621f40623ba04fd510db65.tar.gz
Move all mdoc(7) node validation done before child parsing
to the new separate validation pass, except for a tiny bit needed by the parser which goes to the new mdoc_state() module; cleaner, simpler, and surprisingly also shorter by 15 lines.
Diffstat (limited to 'mdoc_state.c')
-rw-r--r--mdoc_state.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/mdoc_state.c b/mdoc_state.c
index 903ad436..849ea43e 100644
--- a/mdoc_state.c
+++ b/mdoc_state.c
@@ -30,6 +30,7 @@
typedef void (*state_handler)(STATE_ARGS);
static void state_bd(STATE_ARGS);
+static void state_bl(STATE_ARGS);
static void state_dl(STATE_ARGS);
static void state_sh(STATE_ARGS);
static void state_sm(STATE_ARGS);
@@ -46,7 +47,7 @@ static const state_handler state_handlers[MDOC_MAX] = {
state_dl, /* Dl */
state_bd, /* Bd */
NULL, /* Ed */
- NULL, /* Bl */
+ state_bl, /* Bl */
NULL, /* El */
NULL, /* It */
NULL, /* Ad */
@@ -202,6 +203,25 @@ state_bd(STATE_ARGS)
}
static void
+state_bl(STATE_ARGS)
+{
+
+ if (n->type != ROFFT_HEAD || n->parent->args == NULL)
+ return;
+
+ switch(n->parent->args->argv[0].arg) {
+ case MDOC_Diag:
+ n->norm->Bl.type = LIST_diag;
+ break;
+ case MDOC_Column:
+ n->norm->Bl.type = LIST_column;
+ break;
+ default:
+ break;
+ }
+}
+
+static void
state_dl(STATE_ARGS)
{