diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2015-10-22 21:54:23 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2015-10-22 21:54:23 +0000 |
commit | 54ffa6b6bcb97f97cc0a3604078eb63aa8c759ef (patch) | |
tree | dc900d7df0c1cae2b95adfcc260ada272f57839b /man.c | |
parent | 9953b888e25942fa632d3e754daa293a4239d4c5 (diff) | |
download | mandoc-54ffa6b6bcb97f97cc0a3604078eb63aa8c759ef.tar.gz |
move man(7) validation into the dedicated validation phase, too
Diffstat (limited to 'man.c')
-rw-r--r-- | man.c | 35 |
1 files changed, 35 insertions, 0 deletions
@@ -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; +} |