summaryrefslogtreecommitdiffstats
path: root/mdoc_term.c
diff options
context:
space:
mode:
Diffstat (limited to 'mdoc_term.c')
-rw-r--r--mdoc_term.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/mdoc_term.c b/mdoc_term.c
index efa6e09d..849fc894 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -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: