summaryrefslogtreecommitdiffstats
path: root/man_validate.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-10-22 21:54:23 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-10-22 21:54:23 +0000
commit54ffa6b6bcb97f97cc0a3604078eb63aa8c759ef (patch)
treedc900d7df0c1cae2b95adfcc260ada272f57839b /man_validate.c
parent9953b888e25942fa632d3e754daa293a4239d4c5 (diff)
downloadmandoc-54ffa6b6bcb97f97cc0a3604078eb63aa8c759ef.tar.gz
move man(7) validation into the dedicated validation phase, too
Diffstat (limited to 'man_validate.c')
-rw-r--r--man_validate.c49
1 files changed, 17 insertions, 32 deletions
diff --git a/man_validate.c b/man_validate.c
index 490c68e6..ad8206b6 100644
--- a/man_validate.c
+++ b/man_validate.c
@@ -48,9 +48,7 @@ static void check_text(CHKARGS);
static void post_AT(CHKARGS);
static void post_IP(CHKARGS);
static void post_vs(CHKARGS);
-static void post_fi(CHKARGS);
static void post_ft(CHKARGS);
-static void post_nf(CHKARGS);
static void post_OP(CHKARGS);
static void post_TH(CHKARGS);
static void post_UC(CHKARGS);
@@ -79,8 +77,8 @@ static v_check man_valids[MAN_MAX] = {
NULL, /* IR */
NULL, /* RI */
post_vs, /* sp */
- post_nf, /* nf */
- post_fi, /* fi */
+ NULL, /* nf */
+ NULL, /* fi */
NULL, /* RE */
check_part, /* RS */
NULL, /* DT */
@@ -90,8 +88,8 @@ static v_check man_valids[MAN_MAX] = {
NULL, /* in */
post_ft, /* ft */
post_OP, /* OP */
- post_nf, /* EX */
- post_fi, /* EE */
+ NULL, /* EX */
+ NULL, /* EE */
post_UR, /* UR */
NULL, /* UE */
NULL, /* ll */
@@ -99,16 +97,23 @@ static v_check man_valids[MAN_MAX] = {
void
-man_valid_post(struct roff_man *man)
+man_node_validate(struct roff_man *man)
{
struct roff_node *n;
v_check *cp;
n = man->last;
- if (n->flags & MAN_VALID)
- return;
- n->flags |= MAN_VALID;
+ man->last = man->last->child;
+ while (man->last != NULL) {
+ man_node_validate(man);
+ if (man->last == n)
+ man->last = man->last->child;
+ else
+ man->last = man->last->next;
+ }
+ man->last = n;
+ man->next = ROFF_NEXT_SIBLING;
switch (n->type) {
case ROFFT_TEXT:
check_text(man, n);
@@ -123,6 +128,8 @@ man_valid_post(struct roff_man *man)
cp = man_valids + n->tok;
if (*cp)
(*cp)(man, n);
+ if (man->last == n)
+ man_state(man, n);
break;
}
}
@@ -386,28 +393,6 @@ post_TH(CHKARGS)
}
static void
-post_nf(CHKARGS)
-{
-
- if (man->flags & MAN_LITERAL)
- mandoc_msg(MANDOCERR_NF_SKIP, man->parse,
- n->line, n->pos, "nf");
-
- man->flags |= MAN_LITERAL;
-}
-
-static void
-post_fi(CHKARGS)
-{
-
- if ( ! (MAN_LITERAL & man->flags))
- mandoc_msg(MANDOCERR_FI_SKIP, man->parse,
- n->line, n->pos, "fi");
-
- man->flags &= ~MAN_LITERAL;
-}
-
-static void
post_UC(CHKARGS)
{
static const char * const bsd_versions[] = {