version 1.70, 2009/03/23 14:22:11 |
version 1.71, 2009/03/23 15:20:51 |
|
|
* in macro.c, validate.c and action.c. |
* in macro.c, validate.c and action.c. |
*/ |
*/ |
|
|
/* FIXME: have this accept line/pos/tok. */ |
|
static struct mdoc_node *mdoc_node_alloc(const struct mdoc *); |
|
static int mdoc_node_append(struct mdoc *, |
|
struct mdoc_node *); |
|
|
|
static int parsetext(struct mdoc *, int, char *); |
|
static int parsemacro(struct mdoc *, int, char *); |
|
static int macrowarn(struct mdoc *, int, const char *); |
|
|
|
|
|
const char *const __mdoc_macronames[MDOC_MAX] = { |
const char *const __mdoc_macronames[MDOC_MAX] = { |
"\\\"", "Dd", "Dt", "Os", |
"\\\"", "Dd", "Dt", "Os", |
"Sh", "Ss", "Pp", "D1", |
"Sh", "Ss", "Pp", "D1", |
Line 95 const char *const __mdoc_argnames[MDOC_ARG_MAX] = { |
|
Line 85 const char *const __mdoc_argnames[MDOC_ARG_MAX] = { |
|
const char * const *mdoc_macronames = __mdoc_macronames; |
const char * const *mdoc_macronames = __mdoc_macronames; |
const char * const *mdoc_argnames = __mdoc_argnames; |
const char * const *mdoc_argnames = __mdoc_argnames; |
|
|
|
/* FIXME: have this accept line/pos/tok. */ |
|
/* FIXME: mdoc_alloc1 and mdoc_free1 like in man.c. */ |
|
static struct mdoc_node *mdoc_node_alloc(const struct mdoc *); |
|
static int mdoc_node_append(struct mdoc *, |
|
struct mdoc_node *); |
|
|
|
static int parsetext(struct mdoc *, int, char *); |
|
static int parsemacro(struct mdoc *, int, char *); |
|
static int macrowarn(struct mdoc *, int, const char *); |
|
|
|
|
/* |
/* |
* Get the first (root) node of the parse tree. |
* Get the first (root) node of the parse tree. |
*/ |
*/ |
const struct mdoc_node * |
const struct mdoc_node * |
mdoc_node(const struct mdoc *mdoc) |
mdoc_node(const struct mdoc *m) |
{ |
{ |
|
|
if (MDOC_HALT & mdoc->flags) |
return(MDOC_HALT & m->flags ? NULL : m->first); |
return(NULL); |
|
if (mdoc->first) |
|
assert(MDOC_ROOT == mdoc->first->type); |
|
return(mdoc->first); |
|
} |
} |
|
|
|
|
const struct mdoc_meta * |
const struct mdoc_meta * |
mdoc_meta(const struct mdoc *mdoc) |
mdoc_meta(const struct mdoc *m) |
{ |
{ |
|
|
if (MDOC_HALT & mdoc->flags) |
return(MDOC_HALT & m->flags ? NULL : &m->meta); |
return(NULL); |
|
return(&mdoc->meta); |
|
} |
} |
|
|
|
|
Line 366 mdoc_node_append(struct mdoc *mdoc, struct mdoc_node * |
|
Line 360 mdoc_node_append(struct mdoc *mdoc, struct mdoc_node * |
|
} |
} |
|
|
mdoc->last = p; |
mdoc->last = p; |
|
|
|
switch (p->type) { |
|
case (MDOC_TEXT): |
|
if ( ! mdoc_valid_post(mdoc)) |
|
return(0); |
|
if ( ! mdoc_action_post(mdoc)) |
|
return(0); |
|
break; |
|
default: |
|
break; |
|
} |
|
|
return(1); |
return(1); |
} |
} |
|
|