aboutsummaryrefslogtreecommitdiffstatshomepage
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
commite66bc70731870e9afaa3b406e8e49e65b95bfb57 (patch)
treee5dd94d28e6f4546833c334a078d677f759dd890 /man_validate.c
parent9712be0c6ab0aa2d1baa5449bf191e975946ebdb (diff)
downloadmandoc-e66bc70731870e9afaa3b406e8e49e65b95bfb57.tar.gz
mandoc-e66bc70731870e9afaa3b406e8e49e65b95bfb57.tar.zst
mandoc-e66bc70731870e9afaa3b406e8e49e65b95bfb57.zip
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[] = {