version 1.137, 2018/08/18 02:08:27 |
version 1.138, 2018/12/03 21:00:10 |
|
|
|
|
typedef void (*v_check)(CHKARGS); |
typedef void (*v_check)(CHKARGS); |
|
|
|
static void check_abort(CHKARGS); |
static void check_par(CHKARGS); |
static void check_par(CHKARGS); |
static void check_part(CHKARGS); |
static void check_part(CHKARGS); |
static void check_root(CHKARGS); |
static void check_root(CHKARGS); |
Line 60 static const v_check man_valids[MAN_MAX - MAN_TH] = { |
|
Line 61 static const v_check man_valids[MAN_MAX - MAN_TH] = { |
|
NULL, /* SS */ |
NULL, /* SS */ |
NULL, /* TP */ |
NULL, /* TP */ |
NULL, /* TQ */ |
NULL, /* TQ */ |
check_par, /* LP */ |
check_abort,/* LP */ |
check_par, /* PP */ |
check_par, /* PP */ |
check_par, /* P */ |
check_abort,/* P */ |
post_IP, /* IP */ |
post_IP, /* IP */ |
NULL, /* HP */ |
NULL, /* HP */ |
NULL, /* SM */ |
NULL, /* SM */ |
Line 97 static const v_check man_valids[MAN_MAX - MAN_TH] = { |
|
Line 98 static const v_check man_valids[MAN_MAX - MAN_TH] = { |
|
}; |
}; |
|
|
|
|
|
/* Validate the subtree rooted at man->last. */ |
void |
void |
man_node_validate(struct roff_man *man) |
man_node_validate(struct roff_man *man) |
{ |
{ |
struct roff_node *n; |
struct roff_node *n; |
const v_check *cp; |
const v_check *cp; |
|
|
|
/* |
|
* Translate obsolete macros such that later code |
|
* does not need to look for them. |
|
*/ |
|
|
n = man->last; |
n = man->last; |
|
switch (n->tok) { |
|
case MAN_LP: |
|
case MAN_P: |
|
n->tok = MAN_PP; |
|
break; |
|
default: |
|
break; |
|
} |
|
|
|
/* |
|
* Iterate over all children, recursing into each one |
|
* in turn, depth-first. |
|
*/ |
|
|
man->last = man->last->child; |
man->last = man->last->child; |
while (man->last != NULL) { |
while (man->last != NULL) { |
man_node_validate(man); |
man_node_validate(man); |
Line 113 man_node_validate(struct roff_man *man) |
|
Line 134 man_node_validate(struct roff_man *man) |
|
man->last = man->last->next; |
man->last = man->last->next; |
} |
} |
|
|
|
/* Finally validate the macro itself. */ |
|
|
man->last = n; |
man->last = n; |
man->next = ROFF_NEXT_SIBLING; |
man->next = ROFF_NEXT_SIBLING; |
switch (n->type) { |
switch (n->type) { |
Line 183 check_root(CHKARGS) |
|
Line 206 check_root(CHKARGS) |
|
} |
} |
|
|
static void |
static void |
|
check_abort(CHKARGS) |
|
{ |
|
abort(); |
|
} |
|
|
|
static void |
check_text(CHKARGS) |
check_text(CHKARGS) |
{ |
{ |
char *cp, *p; |
char *cp, *p; |
Line 477 post_vs(CHKARGS) |
|
Line 506 post_vs(CHKARGS) |
|
case MAN_SH: |
case MAN_SH: |
case MAN_SS: |
case MAN_SS: |
case MAN_PP: |
case MAN_PP: |
case MAN_LP: |
|
case MAN_P: |
|
mandoc_vmsg(MANDOCERR_PAR_SKIP, man->parse, n->line, n->pos, |
mandoc_vmsg(MANDOCERR_PAR_SKIP, man->parse, n->line, n->pos, |
"%s after %s", roff_name[n->tok], |
"%s after %s", roff_name[n->tok], |
roff_name[n->parent->tok]); |
roff_name[n->parent->tok]); |