summaryrefslogtreecommitdiffstats
path: root/mdoc.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-01-15 15:46:45 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-01-15 15:46:45 +0000
commit56a9d2b7ed8dde26892ea1ba1b4e61495a3a8ee5 (patch)
tree42b0f334d771c4c2437762ffc49050c6fb23b2fb /mdoc.c
parent70cf8b9ba04f6b8b92ec395086271c6218e80d1b (diff)
downloadmandoc-56a9d2b7ed8dde26892ea1ba1b4e61495a3a8ee5.tar.gz
*** empty log message ***
Diffstat (limited to 'mdoc.c')
-rw-r--r--mdoc.c41
1 files changed, 12 insertions, 29 deletions
diff --git a/mdoc.c b/mdoc.c
index f66246b0..a910823c 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -393,7 +393,7 @@ mdoc_macro(struct mdoc *mdoc, int tok,
static int
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->first);
@@ -406,33 +406,15 @@ mdoc_node_append(struct mdoc *mdoc, struct mdoc_node *p)
else
on = mdoc_macronames[mdoc->last->tok];
- /* FIXME: put this into util.c. */
- switch (mdoc->last->type) {
- case (MDOC_TEXT):
- ot = "text";
- break;
- case (MDOC_BODY):
- 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 */
- }
+ if (MDOC_TEXT == p->type)
+ nn = "<text>";
+ else if (MDOC_ROOT == p->type)
+ nn = "<root>";
+ else
+ nn = mdoc_macronames[p->tok];
+
+ ot = mdoc_type2a(mdoc->last->type);
+ nt = mdoc_type2a(p->type);
switch (mdoc->next) {
case (MDOC_NEXT_SIBLING):
@@ -474,7 +456,8 @@ mdoc_node_append(struct mdoc *mdoc, struct mdoc_node *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);
}