diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2015-04-19 14:00:19 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2015-04-19 14:00:19 +0000 |
commit | eed5e7f1fb85805f1b324c5a4501ed30467ae2a0 (patch) | |
tree | 78f09c634d1cfc1b83be85f07be7ee909cbd6d30 /mdoc.c | |
parent | 344327def21ee64357a9cdf57c5352f1c5575708 (diff) | |
download | mandoc-eed5e7f1fb85805f1b324c5a4501ed30467ae2a0.tar.gz |
Decouple the token code for "no request or macro" from the individual
high-level parsers to allow further unification of functions that
only need to recognize this code, but that don't care about different
high-level macrosets beyond that.
Diffstat (limited to 'mdoc.c')
-rw-r--r-- | mdoc.c | 19 |
1 files changed, 10 insertions, 9 deletions
@@ -36,6 +36,7 @@ #include "libmdoc.h" const char *const __mdoc_macronames[MDOC_MAX + 1] = { + "text", "Ap", "Dd", "Dt", "Os", "Sh", "Ss", "Pp", "D1", "Dl", "Bd", "Ed", "Bl", @@ -66,8 +67,8 @@ const char *const __mdoc_macronames[MDOC_MAX + 1] = { "Lk", "Mt", "Brq", "Bro", "Brc", "%C", "Es", "En", "Dx", "%Q", "br", "sp", - "%U", "Ta", "ll", "text", - }; + "%U", "Ta", "ll", +}; const char *const __mdoc_argnames[MDOC_ARG_MAX] = { "split", "nosplit", "ragged", @@ -81,7 +82,7 @@ const char *const __mdoc_argnames[MDOC_ARG_MAX] = { "symbolic", "nested", "centered" }; -const char * const *mdoc_macronames = __mdoc_macronames; +const char * const *mdoc_macronames = __mdoc_macronames + 1; const char * const *mdoc_argnames = __mdoc_argnames; static int mdoc_ptext(struct roff_man *, int, char *, int); @@ -100,7 +101,7 @@ mdoc_addeqn(struct roff_man *mdoc, const struct eqn *ep) { struct roff_node *n; - n = roff_node_alloc(mdoc, ep->ln, ep->pos, ROFFT_EQN, MDOC_MAX); + n = roff_node_alloc(mdoc, ep->ln, ep->pos, ROFFT_EQN, TOKEN_NONE); n->eqn = ep; if (ep->ln > mdoc->last->line) n->flags |= MDOC_LINE; @@ -113,7 +114,7 @@ mdoc_addspan(struct roff_man *mdoc, const struct tbl_span *sp) { struct roff_node *n; - n = roff_node_alloc(mdoc, sp->line, 0, ROFFT_TBL, MDOC_MAX); + n = roff_node_alloc(mdoc, sp->line, 0, ROFFT_TBL, TOKEN_NONE); n->span = sp; roff_node_append(mdoc, n); mdoc_valid_post(mdoc); @@ -150,7 +151,7 @@ mdoc_parseln(struct roff_man *mdoc, int ln, char *buf, int offs) void mdoc_macro(MACRO_PROT_ARGS) { - assert(tok < MDOC_MAX); + assert(tok > TOKEN_NONE && tok < MDOC_MAX); if (mdoc->flags & MDOC_PBODY) { if (tok == MDOC_Dt) { @@ -258,7 +259,7 @@ mdoc_word_alloc(struct roff_man *mdoc, int line, int pos, const char *p) { struct roff_node *n; - n = roff_node_alloc(mdoc, line, pos, ROFFT_TEXT, MDOC_MAX); + n = roff_node_alloc(mdoc, line, pos, ROFFT_TEXT, TOKEN_NONE); n->string = roff_strdup(mdoc->roff, p); roff_node_append(mdoc, n); mdoc_valid_post(mdoc); @@ -430,9 +431,9 @@ mdoc_pmacro(struct roff_man *mdoc, int ln, char *buf, int offs) mac[i] = '\0'; - tok = (i > 1 && i < 4) ? mdoc_hash_find(mac) : MDOC_MAX; + tok = (i > 1 && i < 4) ? mdoc_hash_find(mac) : TOKEN_NONE; - if (tok == MDOC_MAX) { + if (tok == TOKEN_NONE) { mandoc_msg(MANDOCERR_MACRO, mdoc->parse, ln, sv, buf + sv - 1); return(1); |