version 1.331, 2017/06/07 23:29:48 |
version 1.333, 2017/06/10 01:48:53 |
Line 75 static void post_bx(POST_ARGS); |
|
Line 75 static void post_bx(POST_ARGS); |
|
static void post_defaults(POST_ARGS); |
static void post_defaults(POST_ARGS); |
static void post_display(POST_ARGS); |
static void post_display(POST_ARGS); |
static void post_dd(POST_ARGS); |
static void post_dd(POST_ARGS); |
|
static void post_delim(POST_ARGS); |
static void post_dt(POST_ARGS); |
static void post_dt(POST_ARGS); |
static void post_en(POST_ARGS); |
static void post_en(POST_ARGS); |
static void post_es(POST_ARGS); |
static void post_es(POST_ARGS); |
Line 124 static const v_post __mdoc_valids[MDOC_MAX - MDOC_Dd] |
|
Line 125 static const v_post __mdoc_valids[MDOC_MAX - MDOC_Dd] |
|
post_bl, /* Bl */ |
post_bl, /* Bl */ |
NULL, /* El */ |
NULL, /* El */ |
post_it, /* It */ |
post_it, /* It */ |
NULL, /* Ad */ |
post_delim, /* Ad */ |
post_an, /* An */ |
post_an, /* An */ |
NULL, /* Ap */ |
NULL, /* Ap */ |
post_defaults, /* Ar */ |
post_defaults, /* Ar */ |
NULL, /* Cd */ |
NULL, /* Cd */ |
NULL, /* Cm */ |
post_delim, /* Cm */ |
NULL, /* Dv */ |
post_delim, /* Dv */ |
NULL, /* Er */ |
post_delim, /* Er */ |
NULL, /* Ev */ |
post_delim, /* Ev */ |
post_ex, /* Ex */ |
post_ex, /* Ex */ |
post_fa, /* Fa */ |
post_fa, /* Fa */ |
NULL, /* Fd */ |
NULL, /* Fd */ |
NULL, /* Fl */ |
post_delim, /* Fl */ |
post_fn, /* Fn */ |
post_fn, /* Fn */ |
NULL, /* Ft */ |
post_delim, /* Ft */ |
NULL, /* Ic */ |
post_delim, /* Ic */ |
NULL, /* In */ |
post_delim, /* In */ |
post_defaults, /* Li */ |
post_defaults, /* Li */ |
post_nd, /* Nd */ |
post_nd, /* Nd */ |
post_nm, /* Nm */ |
post_nm, /* Nm */ |
NULL, /* Op */ |
post_delim, /* Op */ |
post_obsolete, /* Ot */ |
post_obsolete, /* Ot */ |
post_defaults, /* Pa */ |
post_defaults, /* Pa */ |
post_rv, /* Rv */ |
post_rv, /* Rv */ |
post_st, /* St */ |
post_st, /* St */ |
NULL, /* Va */ |
post_delim, /* Va */ |
NULL, /* Vt */ |
post_delim, /* Vt */ |
post_xr, /* Xr */ |
post_xr, /* Xr */ |
NULL, /* %A */ |
NULL, /* %A */ |
post_hyph, /* %B */ /* FIXME: can be used outside Rs/Re. */ |
post_hyph, /* %B */ /* FIXME: can be used outside Rs/Re. */ |
Line 164 static const v_post __mdoc_valids[MDOC_MAX - MDOC_Dd] |
|
Line 165 static const v_post __mdoc_valids[MDOC_MAX - MDOC_Dd] |
|
post_hyph, /* %T */ /* FIXME: can be used outside Rs/Re. */ |
post_hyph, /* %T */ /* FIXME: can be used outside Rs/Re. */ |
NULL, /* %V */ |
NULL, /* %V */ |
NULL, /* Ac */ |
NULL, /* Ac */ |
NULL, /* Ao */ |
post_delim, /* Ao */ |
NULL, /* Aq */ |
post_delim, /* Aq */ |
post_at, /* At */ |
post_at, /* At */ |
NULL, /* Bc */ |
NULL, /* Bc */ |
post_bf, /* Bf */ |
post_bf, /* Bf */ |
NULL, /* Bo */ |
post_delim, /* Bo */ |
NULL, /* Bq */ |
NULL, /* Bq */ |
post_xx, /* Bsx */ |
post_xx, /* Bsx */ |
post_bx, /* Bx */ |
post_bx, /* Bx */ |
Line 179 static const v_post __mdoc_valids[MDOC_MAX - MDOC_Dd] |
|
Line 180 static const v_post __mdoc_valids[MDOC_MAX - MDOC_Dd] |
|
NULL, /* Dq */ |
NULL, /* Dq */ |
NULL, /* Ec */ |
NULL, /* Ec */ |
NULL, /* Ef */ |
NULL, /* Ef */ |
NULL, /* Em */ |
post_delim, /* Em */ |
NULL, /* Eo */ |
NULL, /* Eo */ |
post_xx, /* Fx */ |
post_xx, /* Fx */ |
NULL, /* Ms */ |
post_delim, /* Ms */ |
NULL, /* No */ |
post_delim, /* No */ |
post_ns, /* Ns */ |
post_ns, /* Ns */ |
post_xx, /* Nx */ |
post_xx, /* Nx */ |
post_xx, /* Ox */ |
post_xx, /* Ox */ |
NULL, /* Pc */ |
NULL, /* Pc */ |
NULL, /* Pf */ |
NULL, /* Pf */ |
NULL, /* Po */ |
post_delim, /* Po */ |
NULL, /* Pq */ |
post_delim, /* Pq */ |
NULL, /* Qc */ |
NULL, /* Qc */ |
NULL, /* Ql */ |
post_delim, /* Ql */ |
NULL, /* Qo */ |
post_delim, /* Qo */ |
NULL, /* Qq */ |
post_delim, /* Qq */ |
NULL, /* Re */ |
NULL, /* Re */ |
post_rs, /* Rs */ |
post_rs, /* Rs */ |
NULL, /* Sc */ |
NULL, /* Sc */ |
NULL, /* So */ |
post_delim, /* So */ |
NULL, /* Sq */ |
post_delim, /* Sq */ |
post_sm, /* Sm */ |
post_sm, /* Sm */ |
post_hyph, /* Sx */ |
post_hyph, /* Sx */ |
NULL, /* Sy */ |
post_delim, /* Sy */ |
post_useless, /* Tn */ |
post_useless, /* Tn */ |
post_xx, /* Ux */ |
post_xx, /* Ux */ |
NULL, /* Xc */ |
NULL, /* Xc */ |
NULL, /* Xo */ |
NULL, /* Xo */ |
post_fo, /* Fo */ |
post_fo, /* Fo */ |
NULL, /* Fc */ |
NULL, /* Fc */ |
NULL, /* Oo */ |
post_delim, /* Oo */ |
NULL, /* Oc */ |
NULL, /* Oc */ |
post_bk, /* Bk */ |
post_bk, /* Bk */ |
NULL, /* Ek */ |
NULL, /* Ek */ |
post_eoln, /* Bt */ |
post_eoln, /* Bt */ |
NULL, /* Hf */ |
post_obsolete, /* Hf */ |
post_obsolete, /* Fr */ |
post_obsolete, /* Fr */ |
post_eoln, /* Ud */ |
post_eoln, /* Ud */ |
post_lb, /* Lb */ |
post_lb, /* Lb */ |
post_par, /* Lp */ |
post_par, /* Lp */ |
NULL, /* Lk */ |
post_delim, /* Lk */ |
post_defaults, /* Mt */ |
post_defaults, /* Mt */ |
NULL, /* Brq */ |
post_delim, /* Brq */ |
NULL, /* Bro */ |
post_delim, /* Bro */ |
NULL, /* Brc */ |
NULL, /* Brc */ |
NULL, /* %C */ |
NULL, /* %C */ |
post_es, /* Es */ |
post_es, /* Es */ |
Line 408 check_bsd(struct roff_man *mdoc, int ln, int pos, char |
|
Line 409 check_bsd(struct roff_man *mdoc, int ln, int pos, char |
|
} |
} |
|
|
static void |
static void |
|
post_delim(POST_ARGS) |
|
{ |
|
const struct roff_node *nch; |
|
const char *lc; |
|
enum mdelim delim; |
|
|
|
nch = mdoc->last->last; |
|
if (nch == NULL || nch->type != ROFFT_TEXT) |
|
return; |
|
lc = strchr(nch->string, '\0') - 1; |
|
if (lc <= nch->string) |
|
return; |
|
delim = mdoc_isdelim(lc); |
|
if (delim == DELIM_NONE || delim == DELIM_OPEN) |
|
return; |
|
mandoc_vmsg(MANDOCERR_DELIM, mdoc->parse, |
|
nch->line, nch->pos + (lc - nch->string), |
|
"%s%s %s", roff_name[mdoc->last->tok], |
|
nch == mdoc->last->child ? "" : " ...", nch->string); |
|
} |
|
|
|
static void |
post_bl_norm(POST_ARGS) |
post_bl_norm(POST_ARGS) |
{ |
{ |
struct roff_node *n; |
struct roff_node *n; |
Line 782 post_lb(POST_ARGS) |
|
Line 805 post_lb(POST_ARGS) |
|
struct roff_node *n; |
struct roff_node *n; |
const char *p; |
const char *p; |
|
|
|
post_delim(mdoc); |
|
|
n = mdoc->last; |
n = mdoc->last; |
assert(n->child->type == ROFFT_TEXT); |
assert(n->child->type == ROFFT_TEXT); |
mdoc->next = ROFF_NEXT_CHILD; |
mdoc->next = ROFF_NEXT_CHILD; |
Line 794 post_lb(POST_ARGS) |
|
Line 819 post_lb(POST_ARGS) |
|
return; |
return; |
} |
} |
|
|
|
mandoc_vmsg(MANDOCERR_LB_BAD, mdoc->parse, n->child->line, |
|
n->child->pos, "Lb %s", n->child->string); |
|
|
roff_word_alloc(mdoc, n->line, n->pos, "library"); |
roff_word_alloc(mdoc, n->line, n->pos, "library"); |
mdoc->last->flags = NODE_NOSRC; |
mdoc->last->flags = NODE_NOSRC; |
roff_word_alloc(mdoc, n->line, n->pos, "\\(Lq"); |
roff_word_alloc(mdoc, n->line, n->pos, "\\(Lq"); |
Line 1039 post_fa(POST_ARGS) |
|
Line 1067 post_fa(POST_ARGS) |
|
break; |
break; |
} |
} |
} |
} |
|
post_delim(mdoc); |
} |
} |
|
|
static void |
static void |
Line 1061 post_nm(POST_ARGS) |
|
Line 1090 post_nm(POST_ARGS) |
|
mandoc_msg(MANDOCERR_NM_NONAME, mdoc->parse, |
mandoc_msg(MANDOCERR_NM_NONAME, mdoc->parse, |
n->line, n->pos, "Nm"); |
n->line, n->pos, "Nm"); |
|
|
|
if (n->type == ROFFT_ELEM) |
|
post_delim(mdoc); |
|
|
if ((n->type != ROFFT_ELEM && n->type != ROFFT_HEAD) || |
if ((n->type != ROFFT_ELEM && n->type != ROFFT_HEAD) || |
(n->child != NULL && n->child->type == ROFFT_TEXT) || |
(n->child != NULL && n->child->type == ROFFT_TEXT) || |
mdoc->meta.name == NULL) |
mdoc->meta.name == NULL) |
Line 1151 post_defaults(POST_ARGS) |
|
Line 1183 post_defaults(POST_ARGS) |
|
{ |
{ |
struct roff_node *nn; |
struct roff_node *nn; |
|
|
|
if (mdoc->last->child != NULL) { |
|
post_delim(mdoc); |
|
return; |
|
} |
|
|
/* |
/* |
* The `Ar' defaults to "file ..." if no value is provided as an |
* The `Ar' defaults to "file ..." if no value is provided as an |
* argument; the `Mt' and `Pa' macros use "~"; the `Li' just |
* argument; the `Mt' and `Pa' macros use "~"; the `Li' just |
* gets an empty string. |
* gets an empty string. |
*/ |
*/ |
|
|
if (mdoc->last->child != NULL) |
|
return; |
|
|
|
nn = mdoc->last; |
nn = mdoc->last; |
|
|
switch (nn->tok) { |
switch (nn->tok) { |
case MDOC_Ar: |
case MDOC_Ar: |
mdoc->next = ROFF_NEXT_CHILD; |
mdoc->next = ROFF_NEXT_CHILD; |
Line 1225 post_an(POST_ARGS) |
|
Line 1258 post_an(POST_ARGS) |
|
if (nch == NULL) |
if (nch == NULL) |
mandoc_msg(MANDOCERR_MACRO_EMPTY, mdoc->parse, |
mandoc_msg(MANDOCERR_MACRO_EMPTY, mdoc->parse, |
np->line, np->pos, "An"); |
np->line, np->pos, "An"); |
|
else |
|
post_delim(mdoc); |
} else if (nch != NULL) |
} else if (nch != NULL) |
mandoc_vmsg(MANDOCERR_ARG_EXCESS, mdoc->parse, |
mandoc_vmsg(MANDOCERR_ARG_EXCESS, mdoc->parse, |
nch->line, nch->pos, "An ... %s", nch->string); |
nch->line, nch->pos, "An ... %s", nch->string); |
Line 1253 post_xx(POST_ARGS) |
|
Line 1288 post_xx(POST_ARGS) |
|
struct roff_node *n; |
struct roff_node *n; |
const char *os; |
const char *os; |
|
|
|
post_delim(mdoc); |
|
|
n = mdoc->last; |
n = mdoc->last; |
switch (n->tok) { |
switch (n->tok) { |
case MDOC_Bsx: |
case MDOC_Bsx: |
Line 2087 post_xr(POST_ARGS) |
|
Line 2124 post_xr(POST_ARGS) |
|
if (nch->next == NULL) { |
if (nch->next == NULL) { |
mandoc_vmsg(MANDOCERR_XR_NOSEC, mdoc->parse, |
mandoc_vmsg(MANDOCERR_XR_NOSEC, mdoc->parse, |
n->line, n->pos, "Xr %s", nch->string); |
n->line, n->pos, "Xr %s", nch->string); |
return; |
} else |
} |
assert(nch->next == n->last); |
assert(nch->next == n->last); |
post_delim(mdoc); |
} |
} |
|
|
static void |
static void |
Line 2337 post_bx(POST_ARGS) |
|
Line 2374 post_bx(POST_ARGS) |
|
{ |
{ |
struct roff_node *n, *nch; |
struct roff_node *n, *nch; |
const char *macro; |
const char *macro; |
|
|
|
post_delim(mdoc); |
|
|
n = mdoc->last; |
n = mdoc->last; |
nch = n->child; |
nch = n->child; |