summaryrefslogtreecommitdiffstats
path: root/man.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.c
parent9953b888e25942fa632d3e754daa293a4239d4c5 (diff)
downloadmandoc-54ffa6b6bcb97f97cc0a3604078eb63aa8c759ef.tar.gz
move man(7) validation into the dedicated validation phase, too
Diffstat (limited to 'man.c')
-rw-r--r--man.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/man.c b/man.c
index 88a4c24b..f484725a 100644
--- a/man.c
+++ b/man.c
@@ -332,3 +332,38 @@ man_mparse(const struct roff_man *man)
assert(man && man->parse);
return man->parse;
}
+
+void
+man_state(struct roff_man *man, struct roff_node *n)
+{
+
+ switch(n->tok) {
+ case MAN_nf:
+ case MAN_EX:
+ if (man->flags & MAN_LITERAL && ! (n->flags & MAN_VALID))
+ mandoc_msg(MANDOCERR_NF_SKIP, man->parse,
+ n->line, n->pos, "nf");
+ man->flags |= MAN_LITERAL;
+ break;
+ case MAN_fi:
+ case MAN_EE:
+ if ( ! (man->flags & MAN_LITERAL) &&
+ ! (n->flags & MAN_VALID))
+ mandoc_msg(MANDOCERR_FI_SKIP, man->parse,
+ n->line, n->pos, "fi");
+ man->flags &= ~MAN_LITERAL;
+ break;
+ default:
+ break;
+ }
+ man->last->flags |= MAN_VALID;
+}
+
+void
+man_validate(struct roff_man *man)
+{
+
+ man->last = man->first;
+ man_node_validate(man);
+ man->flags &= ~MAN_LITERAL;
+}