diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2017-04-24 23:06:17 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2017-04-24 23:06:17 +0000 |
commit | 34d4ee2337055c6ee3b2c34dbcb0c4a24a7413d1 (patch) | |
tree | ce7efbe6ee6a0cdedc8ecc4d031b69b5516a73c1 /man_validate.c | |
parent | b6c38ba54b141f508c5d22eb714a3e7c79a6c33c (diff) | |
download | mandoc-34d4ee2337055c6ee3b2c34dbcb0c4a24a7413d1.tar.gz |
Continue parser unification:
* Make enum rofft an internal interface as enum roff_tok in "roff.h".
* Represent mdoc and man macros in enum roff_tok.
* Make TOKEN_NONE a proper enum value and use it throughout.
* Put the prologue macros first in the macro tables.
* Unify mdoc_macroname[] and man_macroname[] into roff_name[].
Diffstat (limited to 'man_validate.c')
-rw-r--r-- | man_validate.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/man_validate.c b/man_validate.c index 16d99635..3cf82f92 100644 --- a/man_validate.c +++ b/man_validate.c @@ -1,7 +1,7 @@ /* $OpenBSD$ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> - * Copyright (c) 2010, 2012-2016 Ingo Schwarze <schwarze@openbsd.org> + * Copyright (c) 2010, 2012-2017 Ingo Schwarze <schwarze@openbsd.org> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -54,8 +54,7 @@ static void post_TH(CHKARGS); static void post_UC(CHKARGS); static void post_UR(CHKARGS); -static v_check man_valids[MAN_MAX] = { - post_vs, /* br */ +static const v_check __man_valids[MAN_MAX - MAN_TH] = { post_TH, /* TH */ NULL, /* SH */ NULL, /* SS */ @@ -76,6 +75,7 @@ static v_check man_valids[MAN_MAX] = { NULL, /* I */ NULL, /* IR */ NULL, /* RI */ + post_vs, /* br */ post_vs, /* sp */ NULL, /* nf */ NULL, /* fi */ @@ -94,13 +94,14 @@ static v_check man_valids[MAN_MAX] = { NULL, /* UE */ NULL, /* ll */ }; +static const v_check *man_valids = __man_valids - MAN_TH; void man_node_validate(struct roff_man *man) { struct roff_node *n; - v_check *cp; + const v_check *cp; n = man->last; man->last = man->last->child; @@ -247,7 +248,7 @@ check_part(CHKARGS) if (n->type == ROFFT_BODY && n->child == NULL) mandoc_msg(MANDOCERR_BLK_EMPTY, man->parse, - n->line, n->pos, man_macronames[n->tok]); + n->line, n->pos, roff_name[n->tok]); } static void @@ -263,14 +264,13 @@ check_par(CHKARGS) if (n->child == NULL) mandoc_vmsg(MANDOCERR_PAR_SKIP, man->parse, n->line, n->pos, - "%s empty", man_macronames[n->tok]); + "%s empty", roff_name[n->tok]); break; case ROFFT_HEAD: if (n->child != NULL) mandoc_vmsg(MANDOCERR_ARG_SKIP, - man->parse, n->line, n->pos, - "%s %s%s", man_macronames[n->tok], - n->child->string, + man->parse, n->line, n->pos, "%s %s%s", + roff_name[n->tok], n->child->string, n->child->next != NULL ? " ..." : ""); break; default: @@ -291,7 +291,7 @@ post_IP(CHKARGS) if (n->parent->head->child == NULL && n->child == NULL) mandoc_vmsg(MANDOCERR_PAR_SKIP, man->parse, n->line, n->pos, - "%s empty", man_macronames[n->tok]); + "%s empty", roff_name[n->tok]); break; default: break; @@ -479,8 +479,8 @@ post_vs(CHKARGS) case MAN_SH: case MAN_SS: mandoc_vmsg(MANDOCERR_PAR_SKIP, man->parse, n->line, n->pos, - "%s after %s", man_macronames[n->tok], - man_macronames[n->parent->tok]); + "%s after %s", roff_name[n->tok], + roff_name[n->parent->tok]); /* FALLTHROUGH */ case TOKEN_NONE: /* |