version 1.28, 2009/01/14 11:58:24 |
version 1.32, 2009/01/16 12:23:25 |
Line 200 bodychild_err_eq0(struct mdoc *mdoc) |
|
Line 200 bodychild_err_eq0(struct mdoc *mdoc) |
|
return(1); |
return(1); |
if (NULL == mdoc->last->child) |
if (NULL == mdoc->last->child) |
return(1); |
return(1); |
return(mdoc_warn(mdoc, WARN_ARGS_EQ0)); |
return(mdoc_warn(mdoc, WARN_SYNTAX, "macro suggests no body children")); |
} |
} |
|
|
|
|
Line 212 bodychild_warn_ge1(struct mdoc *mdoc) |
|
Line 212 bodychild_warn_ge1(struct mdoc *mdoc) |
|
return(1); |
return(1); |
if (mdoc->last->child) |
if (mdoc->last->child) |
return(1); |
return(1); |
return(mdoc_warn(mdoc, WARN_ARGS_GE1)); |
return(mdoc_warn(mdoc, WARN_SYNTAX, "macro suggests one or more body children")); |
} |
} |
|
|
|
|
Line 224 elemchild_warn_eq0(struct mdoc *mdoc) |
|
Line 224 elemchild_warn_eq0(struct mdoc *mdoc) |
|
if (NULL == mdoc->last->child) |
if (NULL == mdoc->last->child) |
return(1); |
return(1); |
return(mdoc_pwarn(mdoc, mdoc->last->child->line, |
return(mdoc_pwarn(mdoc, mdoc->last->child->line, |
mdoc->last->child->pos, WARN_ARGS_EQ0)); |
mdoc->last->child->pos, WARN_SYNTAX, "macro suggests no parameters")); |
} |
} |
|
|
|
|
Line 235 elemchild_warn_ge1(struct mdoc *mdoc) |
|
Line 235 elemchild_warn_ge1(struct mdoc *mdoc) |
|
assert(MDOC_ELEM == mdoc->last->type); |
assert(MDOC_ELEM == mdoc->last->type); |
if (mdoc->last->child) |
if (mdoc->last->child) |
return(1); |
return(1); |
return(mdoc_warn(mdoc, WARN_ARGS_GE1)); |
return(mdoc_warn(mdoc, WARN_SYNTAX, "macro suggests one or more parameters")); |
} |
} |
|
|
|
|
Line 246 elemchild_err_eq0(struct mdoc *mdoc) |
|
Line 246 elemchild_err_eq0(struct mdoc *mdoc) |
|
assert(MDOC_ELEM == mdoc->last->type); |
assert(MDOC_ELEM == mdoc->last->type); |
if (NULL == mdoc->last->child) |
if (NULL == mdoc->last->child) |
return(1); |
return(1); |
return(mdoc_err(mdoc, ERR_ARGS_EQ0)); |
return(mdoc_err(mdoc, "macro expects no parameters")); |
} |
} |
|
|
|
|
Line 257 elemchild_err_ge1(struct mdoc *mdoc) |
|
Line 257 elemchild_err_ge1(struct mdoc *mdoc) |
|
assert(MDOC_ELEM == mdoc->last->type); |
assert(MDOC_ELEM == mdoc->last->type); |
if (mdoc->last->child) |
if (mdoc->last->child) |
return(1); |
return(1); |
return(mdoc_err(mdoc, ERR_ARGS_GE1)); |
return(mdoc_err(mdoc, "macro expects one or more parameters")); |
} |
} |
|
|
|
|
Line 270 headchild_err_eq0(struct mdoc *mdoc) |
|
Line 270 headchild_err_eq0(struct mdoc *mdoc) |
|
if (NULL == mdoc->last->child) |
if (NULL == mdoc->last->child) |
return(1); |
return(1); |
return(mdoc_perr(mdoc, mdoc->last->child->line, |
return(mdoc_perr(mdoc, mdoc->last->child->line, |
mdoc->last->child->pos, ERR_ARGS_EQ0)); |
mdoc->last->child->pos, "macro expects no parameters")); |
} |
} |
|
|
|
|
Line 282 headchild_warn_ge1(struct mdoc *mdoc) |
|
Line 282 headchild_warn_ge1(struct mdoc *mdoc) |
|
return(1); |
return(1); |
if (mdoc->last->child) |
if (mdoc->last->child) |
return(1); |
return(1); |
return(mdoc_warn(mdoc, WARN_ARGS_GE1)); |
return(mdoc_warn(mdoc, WARN_SYNTAX, "macro suggests one or more parameters")); |
} |
} |
|
|
|
|
Line 294 headchild_err_ge1(struct mdoc *mdoc) |
|
Line 294 headchild_err_ge1(struct mdoc *mdoc) |
|
return(1); |
return(1); |
if (mdoc->last->child) |
if (mdoc->last->child) |
return(1); |
return(1); |
return(mdoc_err(mdoc, ERR_ARGS_GE1)); |
return(mdoc_err(mdoc, "macro expects one or more parameters")); |
} |
} |
|
|
|
|
Line 306 pre_display(struct mdoc *mdoc, struct mdoc_node *node) |
|
Line 306 pre_display(struct mdoc *mdoc, struct mdoc_node *node) |
|
if (MDOC_BLOCK != node->type) |
if (MDOC_BLOCK != node->type) |
return(1); |
return(1); |
|
|
for (n = mdoc->last; n; n = n->parent) |
assert(mdoc->last); |
|
for (n = mdoc->last->parent; n; n = n->parent) |
if (MDOC_BLOCK == n->type) |
if (MDOC_BLOCK == n->type) |
if (MDOC_Bd == n->tok) |
if (MDOC_Bd == n->tok) |
break; |
break; |
if (NULL == n) |
if (NULL == n) |
return(1); |
return(1); |
return(mdoc_verr(mdoc, node, ERR_SCOPE_NONEST)); |
return(mdoc_nerr(mdoc, node, "displays may not be nested")); |
} |
} |
|
|
|
|
Line 364 pre_bl(struct mdoc *mdoc, struct mdoc_node *node) |
|
Line 365 pre_bl(struct mdoc *mdoc, struct mdoc_node *node) |
|
} |
} |
} |
} |
if (0 == type) |
if (0 == type) |
return(mdoc_err(mdoc, ERR_SYNTAX_ARGMISS)); |
return(mdoc_err(mdoc, "no list type specified")); |
if (0 == err) |
if (0 == err) |
return(1); |
return(1); |
assert(argv); |
assert(argv); |
return(mdoc_perr(mdoc, argv->line, |
return(mdoc_perr(mdoc, argv->line, |
argv->pos, ERR_SYNTAX_ARGBAD)); |
argv->pos, "only one list type possible")); |
} |
} |
|
|
|
|
Line 395 pre_bd(struct mdoc *mdoc, struct mdoc_node *node) |
|
Line 396 pre_bd(struct mdoc *mdoc, struct mdoc_node *node) |
|
/* FALLTHROUGH */ |
/* FALLTHROUGH */ |
case (MDOC_Unfilled): |
case (MDOC_Unfilled): |
/* FALLTHROUGH */ |
/* FALLTHROUGH */ |
|
case (MDOC_Filled): |
|
/* FALLTHROUGH */ |
case (MDOC_Literal): |
case (MDOC_Literal): |
/* FALLTHROUGH */ |
/* FALLTHROUGH */ |
case (MDOC_File): |
case (MDOC_File): |
Line 407 pre_bd(struct mdoc *mdoc, struct mdoc_node *node) |
|
Line 410 pre_bd(struct mdoc *mdoc, struct mdoc_node *node) |
|
} |
} |
} |
} |
if (0 == type) |
if (0 == type) |
return(mdoc_err(mdoc, ERR_SYNTAX_ARGMISS)); |
return(mdoc_err(mdoc, "no display type specified")); |
if (0 == err) |
if (0 == err) |
return(1); |
return(1); |
assert(argv); |
assert(argv); |
return(mdoc_perr(mdoc, argv->line, |
return(mdoc_perr(mdoc, argv->line, |
argv->pos, ERR_SYNTAX_ARGBAD)); |
argv->pos, "only one display type possible")); |
} |
} |
|
|
|
|
Line 425 pre_it(struct mdoc *mdoc, struct mdoc_node *node) |
|
Line 428 pre_it(struct mdoc *mdoc, struct mdoc_node *node) |
|
assert(MDOC_It == mdoc->last->tok); |
assert(MDOC_It == mdoc->last->tok); |
|
|
if (MDOC_BODY != mdoc->last->parent->type) |
if (MDOC_BODY != mdoc->last->parent->type) |
return(mdoc_verr(mdoc, node, ERR_SYNTAX_PARENTBAD)); |
return(mdoc_nerr(mdoc, node, "invalid macro parent `%s'", mdoc_macronames[mdoc->last->parent->tok])); |
if (MDOC_Bl != mdoc->last->parent->tok) |
if (MDOC_Bl != mdoc->last->parent->tok) |
return(mdoc_verr(mdoc, node, ERR_SYNTAX_PARENTBAD)); |
return(mdoc_nerr(mdoc, node, "invalid macro parent `%s'", mdoc_macronames[mdoc->last->parent->tok])); |
|
|
return(1); |
return(1); |
} |
} |
Line 438 pre_prologue(struct mdoc *mdoc, struct mdoc_node *node |
|
Line 441 pre_prologue(struct mdoc *mdoc, struct mdoc_node *node |
|
{ |
{ |
|
|
if (SEC_PROLOGUE != mdoc->sec_lastn) |
if (SEC_PROLOGUE != mdoc->sec_lastn) |
return(mdoc_verr(mdoc, node, ERR_SEC_NPROLOGUE)); |
return(mdoc_nerr(mdoc, node, "macro may only be invoked in the prologue")); |
assert(MDOC_ELEM == node->type); |
assert(MDOC_ELEM == node->type); |
|
|
/* Check for ordering. */ |
/* Check for ordering. */ |
Line 447 pre_prologue(struct mdoc *mdoc, struct mdoc_node *node |
|
Line 450 pre_prologue(struct mdoc *mdoc, struct mdoc_node *node |
|
case (MDOC_Os): |
case (MDOC_Os): |
if (mdoc->meta.title[0] && mdoc->meta.date) |
if (mdoc->meta.title[0] && mdoc->meta.date) |
break; |
break; |
return(mdoc_verr(mdoc, node, ERR_SEC_PROLOGUE_OO)); |
return(mdoc_nerr(mdoc, node, "prologue macro out-of-order")); |
case (MDOC_Dt): |
case (MDOC_Dt): |
if (0 == mdoc->meta.title[0] && mdoc->meta.date) |
if (0 == mdoc->meta.title[0] && mdoc->meta.date) |
break; |
break; |
return(mdoc_verr(mdoc, node, ERR_SEC_PROLOGUE_OO)); |
return(mdoc_nerr(mdoc, node, "prologue macro out-of-order")); |
case (MDOC_Dd): |
case (MDOC_Dd): |
if (0 == mdoc->meta.title[0] && 0 == mdoc->meta.date) |
if (0 == mdoc->meta.title[0] && 0 == mdoc->meta.date) |
break; |
break; |
return(mdoc_verr(mdoc, node, ERR_SEC_PROLOGUE_OO)); |
return(mdoc_nerr(mdoc, node, "prologue macro out-of-order")); |
default: |
default: |
abort(); |
abort(); |
/* NOTREACHED */ |
/* NOTREACHED */ |
Line 481 pre_prologue(struct mdoc *mdoc, struct mdoc_node *node |
|
Line 484 pre_prologue(struct mdoc *mdoc, struct mdoc_node *node |
|
/* NOTREACHED */ |
/* NOTREACHED */ |
} |
} |
|
|
return(mdoc_verr(mdoc, node, ERR_SEC_PROLOGUE_REP)); |
return(mdoc_nerr(mdoc, node, "prologue macro repeated")); |
} |
} |
|
|
|
|
Line 550 post_it(struct mdoc *mdoc) |
|
Line 553 post_it(struct mdoc *mdoc) |
|
|
|
if (TYPE_HEAD == type) { |
if (TYPE_HEAD == type) { |
if (NULL == (n = mdoc->last->data.block.head)) { |
if (NULL == (n = mdoc->last->data.block.head)) { |
if ( ! mdoc_warn(mdoc, WARN_SYNTAX_EMPTYHEAD)) |
if ( ! mdoc_warn(mdoc, WARN_SYNTAX, "macro suggests line parameters")) |
return(0); |
return(0); |
} else if (NULL == n->child) |
} else if (NULL == n->child) |
if ( ! mdoc_warn(mdoc, WARN_SYNTAX_EMPTYHEAD)) |
if ( ! mdoc_warn(mdoc, WARN_SYNTAX, "macro suggests line parameters")) |
return(0); |
return(0); |
|
|
if (NULL == (n = mdoc->last->data.block.body)) { |
if (NULL == (n = mdoc->last->data.block.body)) { |
if ( ! mdoc_warn(mdoc, WARN_SYNTAX_EMPTYBODY)) |
if ( ! mdoc_warn(mdoc, WARN_SYNTAX, "macro suggests body children")) |
return(0); |
return(0); |
} else if (NULL == n->child) |
} else if (NULL == n->child) |
if ( ! mdoc_warn(mdoc, WARN_SYNTAX_EMPTYBODY)) |
if ( ! mdoc_warn(mdoc, WARN_SYNTAX, "macro suggests body children")) |
return(0); |
return(0); |
|
|
return(1); |
return(1); |
} |
} |
|
|
if (NULL == (n = mdoc->last->data.block.head)) { |
if (NULL == (n = mdoc->last->data.block.head)) { |
if ( ! mdoc_warn(mdoc, WARN_SYNTAX_EMPTYHEAD)) |
if ( ! mdoc_warn(mdoc, WARN_SYNTAX, "macro suggests line parameters")) |
return(0); |
return(0); |
} else if (NULL == n->child) |
} else if (NULL == n->child) |
if ( ! mdoc_warn(mdoc, WARN_SYNTAX_EMPTYHEAD)) |
if ( ! mdoc_warn(mdoc, WARN_SYNTAX, "macro suggests line parameters")) |
return(0); |
return(0); |
|
|
if ((n = mdoc->last->data.block.body) && n->child) |
if ((n = mdoc->last->data.block.body) && n->child) |
if ( ! mdoc_warn(mdoc, WARN_SYNTAX_NOBODY)) |
if ( ! mdoc_warn(mdoc, WARN_SYNTAX, "macro suggests body children")) |
return(0); |
return(0); |
|
|
if (MDOC_Column != sv) |
if (MDOC_Column != sv) |
Line 590 post_it(struct mdoc *mdoc) |
|
Line 593 post_it(struct mdoc *mdoc) |
|
|
|
if (i == (size_t)sv) |
if (i == (size_t)sv) |
return(1); |
return(1); |
return(mdoc_err(mdoc, ERR_SYNTAX_ARGFORM)); |
return(mdoc_err(mdoc, "expected %d list columns, have %d", sv, (int)i)); |
|
|
#undef TYPE_NONE |
#undef TYPE_NONE |
#undef TYPE_BODY |
#undef TYPE_BODY |
Line 616 post_bl(struct mdoc *mdoc) |
|
Line 619 post_bl(struct mdoc *mdoc) |
|
} |
} |
if (NULL == n) |
if (NULL == n) |
return(1); |
return(1); |
return(mdoc_verr(mdoc, n, ERR_SYNTAX_CHILDBAD)); |
return(mdoc_nerr(mdoc, n, "invalid child of parent macro `Bl'")); |
} |
} |
|
|
|
|
Line 651 post_sh(struct mdoc *mdoc) |
|
Line 654 post_sh(struct mdoc *mdoc) |
|
return(1); |
return(1); |
|
|
if (sec == mdoc->sec_lastn) |
if (sec == mdoc->sec_lastn) |
return(mdoc_warn(mdoc, WARN_SEC_REP)); |
return(mdoc_warn(mdoc, WARN_SYNTAX, "section repeated")); |
return(mdoc_warn(mdoc, WARN_SEC_OO)); |
return(mdoc_warn(mdoc, WARN_SYNTAX, "section out of conventional order")); |
} |
} |
|
|
|
|