aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-05-04 17:48:28 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-05-04 17:48:28 +0000
commit6cff4f9d35431af8274477e9e1cd8dbb193f159a (patch)
tree915d9a7213a5eb4bcdd275befff13cc2a5e27720 /mdoc_term.c
parent094f88dec3c7fd9ede485ab47df6943bd7686330 (diff)
downloadmandoc-6cff4f9d35431af8274477e9e1cd8dbb193f159a.tar.gz
mandoc-6cff4f9d35431af8274477e9e1cd8dbb193f159a.tar.zst
mandoc-6cff4f9d35431af8274477e9e1cd8dbb193f159a.zip
Parser reorg:
Generate the first node on the roff level: .br Fix some column numbers in diagnostic messages while here.
Diffstat (limited to 'mdoc_term.c')
-rw-r--r--mdoc_term.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/mdoc_term.c b/mdoc_term.c
index bce0f322..12cd0336 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.350 2017/04/24 23:06:18 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.351 2017/05/04 17:48:29 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -244,7 +244,6 @@ static const struct termact __termacts[MDOC_MAX - MDOC_Dd] = {
{ termp_quote_pre, termp_quote_post }, /* En */
{ termp_xx_pre, termp_xx_post }, /* Dx */
{ NULL, termp____post }, /* %Q */
- { termp_sp_pre, NULL }, /* br */
{ termp_sp_pre, NULL }, /* sp */
{ NULL, termp____post }, /* %U */
{ NULL, NULL }, /* Ta */
@@ -365,6 +364,17 @@ print_mdoc_node(DECL_ARGS)
term_tbl(p, n->span);
break;
default:
+ if (n->tok < ROFF_MAX) {
+ switch (n->tok) {
+ case ROFF_br:
+ termp_sp_pre(p, &npair, meta, n);
+ break;
+ default:
+ abort();
+ }
+ break;
+ }
+ assert(n->tok >= MDOC_Dd && n->tok < MDOC_MAX);
if (termacts[n->tok].pre != NULL &&
(n->end == ENDBODY_NOT || n->child != NULL))
chld = (*termacts[n->tok].pre)
@@ -386,7 +396,9 @@ print_mdoc_node(DECL_ARGS)
case ROFFT_EQN:
break;
default:
- if (termacts[n->tok].post == NULL || n->flags & NODE_ENDED)
+ if (n->tok < ROFF_MAX ||
+ termacts[n->tok].post == NULL ||
+ n->flags & NODE_ENDED)
break;
(void)(*termacts[n->tok].post)(p, &npair, meta, n);
@@ -1504,7 +1516,7 @@ termp_bd_pre(DECL_ARGS)
*/
switch (nn->tok) {
case MDOC_Sm:
- case MDOC_br:
+ case ROFF_br:
case MDOC_sp:
case MDOC_Bl:
case MDOC_D1:
@@ -1666,7 +1678,7 @@ termp_sp_pre(DECL_ARGS)
} else
len = 1;
break;
- case MDOC_br:
+ case ROFF_br:
len = 0;
break;
default: