aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_state.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_state.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_state.c')
-rw-r--r--mdoc_state.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/mdoc_state.c b/mdoc_state.c
index c3d23197..3938f239 100644
--- a/mdoc_state.c
+++ b/mdoc_state.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_state.c,v 1.5 2017/04/24 23:06:18 schwarze Exp $ */
+/* $Id: mdoc_state.c,v 1.6 2017/05/04 17:48:29 schwarze Exp $ */
/*
* Copyright (c) 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -16,6 +16,7 @@
*/
#include <sys/types.h>
+#include <assert.h>
#include <stdlib.h>
#include <string.h>
@@ -154,7 +155,6 @@ static const state_handler __state_handlers[MDOC_MAX - MDOC_Dd] = {
NULL, /* En */
NULL, /* Dx */
NULL, /* %Q */
- NULL, /* br */
NULL, /* sp */
NULL, /* %U */
NULL, /* Ta */
@@ -168,9 +168,10 @@ mdoc_state(struct roff_man *mdoc, struct roff_node *n)
{
state_handler handler;
- if (n->tok == TOKEN_NONE)
+ if (n->tok == TOKEN_NONE || n->tok < ROFF_MAX)
return;
+ assert(n->tok >= MDOC_Dd && n->tok < MDOC_MAX);
if ( ! (mdoc_macros[n->tok].flags & MDOC_PROLOGUE))
mdoc->flags |= MDOC_PBODY;