From 6cff4f9d35431af8274477e9e1cd8dbb193f159a Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Thu, 4 May 2017 17:48:28 +0000 Subject: Parser reorg: Generate the first node on the roff level: .br Fix some column numbers in diagnostic messages while here. --- mdoc_validate.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'mdoc_validate.c') diff --git a/mdoc_validate.c b/mdoc_validate.c index 38283674..75ec2e35 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_validate.c,v 1.322 2017/04/29 12:45:42 schwarze Exp $ */ +/* $Id: mdoc_validate.c,v 1.323 2017/05/04 17:48:29 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2017 Ingo Schwarze @@ -227,7 +227,6 @@ static const v_post __mdoc_valids[MDOC_MAX - MDOC_Dd] = { post_en, /* En */ post_xx, /* Dx */ NULL, /* %Q */ - post_par, /* br */ post_par, /* sp */ NULL, /* %U */ NULL, /* Ta */ @@ -327,6 +326,18 @@ mdoc_node_validate(struct roff_man *mdoc) /* Call the macro's postprocessor. */ + if (n->tok < ROFF_MAX) { + switch(n->tok) { + case ROFF_br: + post_par(mdoc); + break; + default: + abort(); + } + break; + } + + assert(n->tok >= MDOC_Dd && n->tok < MDOC_MAX); p = mdoc_valids + n->tok; if (*p) (*p)(mdoc); @@ -1310,7 +1321,7 @@ post_bl_block(POST_ARGS) switch (nc->tok) { case MDOC_Pp: case MDOC_Lp: - case MDOC_br: + case ROFF_br: break; default: nc = NULL; @@ -2064,7 +2075,7 @@ post_prevpar(POST_ARGS) if (n->prev->tok != MDOC_Pp && n->prev->tok != MDOC_Lp && - n->prev->tok != MDOC_br) + n->prev->tok != ROFF_br) return; if (n->tok == MDOC_Bl && n->norm->Bl.comp) return; @@ -2085,7 +2096,7 @@ post_par(POST_ARGS) struct roff_node *np; np = mdoc->last; - if (np->tok != MDOC_br && np->tok != MDOC_sp) + if (np->tok != ROFF_br && np->tok != MDOC_sp) post_prevpar(mdoc); if (np->tok == MDOC_sp) { @@ -2103,8 +2114,8 @@ post_par(POST_ARGS) if (np->tok != MDOC_Sh && np->tok != MDOC_Ss) return; } else if (np->tok != MDOC_Pp && np->tok != MDOC_Lp && - (mdoc->last->tok != MDOC_br || - (np->tok != MDOC_sp && np->tok != MDOC_br))) + (mdoc->last->tok != ROFF_br || + (np->tok != MDOC_sp && np->tok != ROFF_br))) return; mandoc_vmsg(MANDOCERR_PAR_SKIP, mdoc->parse, -- cgit v1.2.3-56-ge451