version 1.28, 2009/01/12 16:39:57 |
version 1.30, 2009/01/15 15:46:45 |
Line 94 const struct mdoc_macro __mdoc_macros[MDOC_MAX] = { |
|
Line 94 const struct mdoc_macro __mdoc_macros[MDOC_MAX] = { |
|
{ macro_scoped_line, MDOC_PARSED }, /* D1 */ |
{ macro_scoped_line, MDOC_PARSED }, /* D1 */ |
{ macro_scoped_line, MDOC_PARSED }, /* Dl */ |
{ macro_scoped_line, MDOC_PARSED }, /* Dl */ |
{ macro_scoped, MDOC_EXPLICIT }, /* Bd */ |
{ macro_scoped, MDOC_EXPLICIT }, /* Bd */ |
{ macro_close_explicit, 0 }, /* Ed */ |
{ macro_scoped_close, MDOC_EXPLICIT }, /* Ed */ |
{ macro_scoped, MDOC_EXPLICIT }, /* Bl */ |
{ macro_scoped, MDOC_EXPLICIT }, /* Bl */ |
{ macro_close_explicit, 0 }, /* El */ |
{ macro_scoped_close, MDOC_EXPLICIT }, /* El */ |
{ macro_scoped, MDOC_NESTED | MDOC_PARSED | MDOC_TABSEP}, /* It */ |
{ macro_scoped, MDOC_PARSED | MDOC_TABSEP}, /* It */ |
{ macro_text, MDOC_CALLABLE | MDOC_PARSED }, /* Ad */ |
{ macro_text, MDOC_CALLABLE | MDOC_PARSED }, /* Ad */ |
{ macro_constant, MDOC_PARSED }, /* An */ |
{ macro_constant, MDOC_PARSED }, /* An */ |
{ macro_text, MDOC_CALLABLE | MDOC_PARSED }, /* Ar */ |
{ macro_text, MDOC_CALLABLE | MDOC_PARSED }, /* Ar */ |
Line 137 const struct mdoc_macro __mdoc_macros[MDOC_MAX] = { |
|
Line 137 const struct mdoc_macro __mdoc_macros[MDOC_MAX] = { |
|
{ macro_constant, MDOC_QUOTABLE }, /* %R */ |
{ macro_constant, MDOC_QUOTABLE }, /* %R */ |
{ macro_constant, MDOC_QUOTABLE }, /* %T */ |
{ macro_constant, MDOC_QUOTABLE }, /* %T */ |
{ macro_constant, MDOC_QUOTABLE }, /* %V */ |
{ macro_constant, MDOC_QUOTABLE }, /* %V */ |
{ macro_close_explicit, MDOC_CALLABLE | MDOC_PARSED }, /* Ac */ |
{ macro_scoped_close, MDOC_EXPLICIT | MDOC_CALLABLE | MDOC_PARSED }, /* Ac */ |
{ macro_constant_scoped, MDOC_CALLABLE | MDOC_PARSED }, /* Ao */ |
{ macro_constant_scoped, MDOC_CALLABLE | MDOC_PARSED | MDOC_EXPLICIT }, /* Ao */ |
{ macro_scoped_line, MDOC_CALLABLE | MDOC_PARSED }, /* Aq */ |
{ macro_scoped_line, MDOC_CALLABLE | MDOC_PARSED }, /* Aq */ |
{ macro_constant, 0 }, /* At */ |
{ macro_constant, 0 }, /* At */ |
{ macro_close_explicit, MDOC_CALLABLE | MDOC_PARSED }, /* Bc */ |
{ macro_scoped_close, MDOC_EXPLICIT | MDOC_CALLABLE | MDOC_PARSED }, /* Bc */ |
{ macro_scoped, MDOC_EXPLICIT }, /* Bf */ |
{ macro_scoped, MDOC_EXPLICIT }, /* Bf */ |
{ macro_constant_scoped, MDOC_CALLABLE | MDOC_PARSED }, /* Bo */ |
{ macro_constant_scoped, MDOC_CALLABLE | MDOC_PARSED | MDOC_EXPLICIT }, /* Bo */ |
{ macro_scoped_line, MDOC_CALLABLE | MDOC_PARSED }, /* Bq */ |
{ macro_scoped_line, MDOC_CALLABLE | MDOC_PARSED }, /* Bq */ |
{ macro_constant_delimited, MDOC_PARSED }, /* Bsx */ |
{ macro_constant_delimited, MDOC_PARSED }, /* Bsx */ |
{ macro_constant_delimited, MDOC_PARSED }, /* Bx */ |
{ macro_constant_delimited, MDOC_PARSED }, /* Bx */ |
{ macro_constant, 0 }, /* Db */ |
{ macro_constant, 0 }, /* Db */ |
{ macro_close_explicit, MDOC_CALLABLE | MDOC_PARSED }, /* Dc */ |
{ macro_scoped_close, MDOC_EXPLICIT | MDOC_CALLABLE | MDOC_PARSED }, /* Dc */ |
{ macro_constant_scoped, MDOC_CALLABLE | MDOC_PARSED }, /* Do */ |
{ macro_constant_scoped, MDOC_CALLABLE | MDOC_PARSED | MDOC_EXPLICIT }, /* Do */ |
{ macro_scoped_line, MDOC_CALLABLE | MDOC_PARSED }, /* Dq */ |
{ macro_scoped_line, MDOC_CALLABLE | MDOC_PARSED }, /* Dq */ |
{ macro_close_explicit, MDOC_CALLABLE | MDOC_PARSED }, /* Ec */ |
{ macro_scoped_close, MDOC_EXPLICIT | MDOC_CALLABLE | MDOC_PARSED }, /* Ec */ |
{ macro_close_explicit, 0 }, /* Ef */ |
{ macro_scoped_close, MDOC_EXPLICIT }, /* Ef */ |
{ macro_text, MDOC_CALLABLE | MDOC_PARSED }, /* Em */ |
{ macro_text, MDOC_CALLABLE | MDOC_PARSED }, /* Em */ |
{ macro_constant_scoped, MDOC_CALLABLE | MDOC_PARSED }, /* Eo */ |
{ macro_constant_scoped, MDOC_CALLABLE | MDOC_PARSED | MDOC_EXPLICIT }, /* Eo */ |
{ macro_constant_delimited, MDOC_PARSED }, /* Fx */ |
{ macro_constant_delimited, MDOC_PARSED }, /* Fx */ |
{ macro_text, MDOC_PARSED }, /* Ms */ |
{ macro_text, MDOC_PARSED }, /* Ms */ |
{ macro_constant_delimited, MDOC_CALLABLE | MDOC_PARSED }, /* No */ |
{ macro_constant_delimited, MDOC_CALLABLE | MDOC_PARSED }, /* No */ |
{ macro_constant_delimited, MDOC_CALLABLE | MDOC_PARSED }, /* Ns */ |
{ macro_constant_delimited, MDOC_CALLABLE | MDOC_PARSED }, /* Ns */ |
{ macro_constant_delimited, MDOC_PARSED }, /* Nx */ |
{ macro_constant_delimited, MDOC_PARSED }, /* Nx */ |
{ macro_constant_delimited, MDOC_PARSED }, /* Ox */ |
{ macro_constant_delimited, MDOC_PARSED }, /* Ox */ |
{ macro_close_explicit, MDOC_CALLABLE | MDOC_PARSED }, /* Pc */ |
{ macro_scoped_close, MDOC_EXPLICIT | MDOC_CALLABLE | MDOC_PARSED }, /* Pc */ |
{ macro_constant, MDOC_PARSED }, /* Pf */ |
{ macro_constant, MDOC_PARSED }, /* Pf */ |
{ macro_constant_scoped, MDOC_CALLABLE | MDOC_PARSED }, /* Po */ |
{ macro_constant_scoped, MDOC_CALLABLE | MDOC_PARSED | MDOC_EXPLICIT }, /* Po */ |
{ macro_scoped_line, MDOC_CALLABLE | MDOC_PARSED }, /* Pq */ |
{ macro_scoped_line, MDOC_CALLABLE | MDOC_PARSED }, /* Pq */ |
{ macro_close_explicit, MDOC_CALLABLE | MDOC_PARSED }, /* Qc */ |
{ macro_scoped_close, MDOC_EXPLICIT | MDOC_CALLABLE | MDOC_PARSED }, /* Qc */ |
{ macro_scoped_line, MDOC_CALLABLE | MDOC_PARSED }, /* Ql */ |
{ macro_scoped_line, MDOC_CALLABLE | MDOC_PARSED }, /* Ql */ |
{ macro_constant_scoped, MDOC_CALLABLE | MDOC_PARSED }, /* Qo */ |
{ macro_constant_scoped, MDOC_CALLABLE | MDOC_PARSED | MDOC_EXPLICIT }, /* Qo */ |
{ macro_scoped_line, MDOC_CALLABLE | MDOC_PARSED }, /* Qq */ |
{ macro_scoped_line, MDOC_CALLABLE | MDOC_PARSED }, /* Qq */ |
{ macro_close_explicit, 0 }, /* Re */ |
{ macro_scoped_close, MDOC_EXPLICIT }, /* Re */ |
{ macro_scoped, MDOC_EXPLICIT }, /* Rs */ |
{ macro_scoped, MDOC_EXPLICIT }, /* Rs */ |
{ macro_close_explicit, MDOC_CALLABLE | MDOC_PARSED }, /* Sc */ |
{ macro_scoped_close, MDOC_EXPLICIT | MDOC_CALLABLE | MDOC_PARSED }, /* Sc */ |
{ macro_constant_scoped, MDOC_CALLABLE | MDOC_PARSED }, /* So */ |
{ macro_constant_scoped, MDOC_CALLABLE | MDOC_PARSED | MDOC_EXPLICIT }, /* So */ |
{ macro_scoped_line, MDOC_CALLABLE | MDOC_PARSED }, /* Sq */ |
{ macro_scoped_line, MDOC_CALLABLE | MDOC_PARSED }, /* Sq */ |
{ macro_constant, 0 }, /* Sm */ |
{ macro_constant, 0 }, /* Sm */ |
{ macro_text, MDOC_CALLABLE | MDOC_PARSED }, /* Sx */ |
{ macro_text, MDOC_CALLABLE | MDOC_PARSED }, /* Sx */ |
{ macro_text, MDOC_CALLABLE | MDOC_PARSED }, /* Sy */ |
{ macro_text, MDOC_CALLABLE | MDOC_PARSED }, /* Sy */ |
{ macro_text, MDOC_CALLABLE | MDOC_PARSED }, /* Tn */ |
{ macro_text, MDOC_CALLABLE | MDOC_PARSED }, /* Tn */ |
{ macro_constant_delimited, MDOC_PARSED }, /* Ux */ |
{ macro_constant_delimited, MDOC_PARSED }, /* Ux */ |
{ macro_close_explicit, MDOC_CALLABLE | MDOC_PARSED }, /* Xc */ |
{ macro_scoped_close, MDOC_EXPLICIT | MDOC_CALLABLE | MDOC_PARSED }, /* Xc */ |
{ macro_constant_scoped, MDOC_CALLABLE | MDOC_PARSED }, /* Xo */ |
{ macro_constant_scoped, MDOC_CALLABLE | MDOC_PARSED | MDOC_EXPLICIT }, /* Xo */ |
/* XXX - .Fo supposed to be (but isn't) callable. */ |
/* XXX - .Fo supposed to be (but isn't) callable. */ |
{ macro_scoped, MDOC_EXPLICIT | MDOC_PARSED }, /* Fo */ |
{ macro_scoped, MDOC_EXPLICIT | MDOC_PARSED }, /* Fo */ |
/* XXX - .Fc supposed to be (but isn't) callable. */ |
/* XXX - .Fc supposed to be (but isn't) callable. */ |
{ macro_close_explicit, MDOC_PARSED }, /* Fc */ |
{ macro_scoped_close, MDOC_EXPLICIT | MDOC_PARSED }, /* Fc */ |
{ macro_constant_scoped, MDOC_CALLABLE | MDOC_PARSED }, /* Oo */ |
{ macro_constant_scoped, MDOC_CALLABLE | MDOC_PARSED | MDOC_EXPLICIT }, /* Oo */ |
{ macro_close_explicit, MDOC_CALLABLE | MDOC_PARSED }, /* Oc */ |
{ macro_scoped_close, MDOC_EXPLICIT | MDOC_CALLABLE | MDOC_PARSED }, /* Oc */ |
{ macro_scoped, MDOC_EXPLICIT }, /* Bk */ |
{ macro_scoped, MDOC_EXPLICIT }, /* Bk */ |
{ macro_close_explicit, 0 }, /* Ek */ |
{ macro_scoped_close, MDOC_EXPLICIT }, /* Ek */ |
{ macro_constant, 0 }, /* Bt */ |
{ macro_constant, 0 }, /* Bt */ |
{ macro_constant, 0 }, /* Hf */ |
{ macro_constant, 0 }, /* Hf */ |
{ macro_obsolete, 0 }, /* Fr */ |
{ macro_obsolete, 0 }, /* Fr */ |
Line 393 mdoc_macro(struct mdoc *mdoc, int tok, |
|
Line 393 mdoc_macro(struct mdoc *mdoc, int tok, |
|
static int |
static int |
mdoc_node_append(struct mdoc *mdoc, struct mdoc_node *p) |
mdoc_node_append(struct mdoc *mdoc, struct mdoc_node *p) |
{ |
{ |
const char *on, *ot, *act; |
const char *nn, *nt, *on, *ot, *act; |
|
|
assert(mdoc->last); |
assert(mdoc->last); |
assert(mdoc->first); |
assert(mdoc->first); |
Line 406 mdoc_node_append(struct mdoc *mdoc, struct mdoc_node * |
|
Line 406 mdoc_node_append(struct mdoc *mdoc, struct mdoc_node * |
|
else |
else |
on = mdoc_macronames[mdoc->last->tok]; |
on = mdoc_macronames[mdoc->last->tok]; |
|
|
/* FIXME: put this into util.c. */ |
if (MDOC_TEXT == p->type) |
switch (mdoc->last->type) { |
nn = "<text>"; |
case (MDOC_TEXT): |
else if (MDOC_ROOT == p->type) |
ot = "text"; |
nn = "<root>"; |
break; |
else |
case (MDOC_BODY): |
nn = mdoc_macronames[p->tok]; |
ot = "body"; |
|
break; |
|
case (MDOC_ELEM): |
|
ot = "elem"; |
|
break; |
|
case (MDOC_HEAD): |
|
ot = "head"; |
|
break; |
|
case (MDOC_TAIL): |
|
ot = "tail"; |
|
break; |
|
case (MDOC_BLOCK): |
|
ot = "block"; |
|
break; |
|
case (MDOC_ROOT): |
|
ot = "root"; |
|
break; |
|
default: |
|
abort(); |
|
/* NOTREACHED */ |
|
} |
|
|
|
|
ot = mdoc_type2a(mdoc->last->type); |
|
nt = mdoc_type2a(p->type); |
|
|
switch (mdoc->next) { |
switch (mdoc->next) { |
case (MDOC_NEXT_SIBLING): |
case (MDOC_NEXT_SIBLING): |
mdoc->last->next = p; |
mdoc->last->next = p; |
Line 474 mdoc_node_append(struct mdoc *mdoc, struct mdoc_node * |
|
Line 456 mdoc_node_append(struct mdoc *mdoc, struct mdoc_node * |
|
} |
} |
|
|
mdoc->last = p; |
mdoc->last = p; |
mdoc_msg(mdoc, "parse: %s of %s `%s'", act, ot, on); |
mdoc_msg(mdoc, "parse: %s `%s' %s of %s `%s'", |
|
nt, nn, act, ot, on); |
return(1); |
return(1); |
} |
} |
|
|