summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-03-23 12:33:01 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-03-23 12:33:01 +0000
commite29490c2a6462d5308d34e9cad6e8b105edbd029 (patch)
tree7b2e6a190f7ba61bdeddabb454eaaef98a233d21
parent95cb195e612a11db010c2773fc911099889bfe6a (diff)
downloadmandoc-e29490c2a6462d5308d34e9cad6e8b105edbd029.tar.gz
Add MAN_TAIL, which will be used by `UE' (forthcoming) and needs to be
used for `RE'.
-rw-r--r--libman.h1
-rw-r--r--man.c17
-rw-r--r--man.h2
-rw-r--r--tree.c5
4 files changed, 25 insertions, 0 deletions
diff --git a/libman.h b/libman.h
index fbcb8a8e..a1afde88 100644
--- a/libman.h
+++ b/libman.h
@@ -67,6 +67,7 @@ __BEGIN_DECLS
int man_word_alloc(struct man *, int, int, const char *);
int man_block_alloc(struct man *, int, int, enum mant);
int man_head_alloc(struct man *, int, int, enum mant);
+int man_tail_alloc(struct man *, int, int, enum mant);
int man_body_alloc(struct man *, int, int, enum mant);
int man_elem_alloc(struct man *, int, int, enum mant);
void man_node_delete(struct man *, struct man_node *);
diff --git a/man.c b/man.c
index 96237058..220278be 100644
--- a/man.c
+++ b/man.c
@@ -203,6 +203,10 @@ man_node_append(struct man *man, struct man_node *p)
assert(MAN_BLOCK == p->parent->type);
p->parent->head = p;
break;
+ case (MAN_TAIL):
+ assert(MAN_BLOCK == p->parent->type);
+ p->parent->tail = p;
+ break;
case (MAN_BODY):
assert(MAN_BLOCK == p->parent->type);
p->parent->body = p;
@@ -261,6 +265,19 @@ man_elem_alloc(struct man *m, int line, int pos, enum mant tok)
int
+man_tail_alloc(struct man *m, int line, int pos, enum mant tok)
+{
+ struct man_node *p;
+
+ p = man_node_alloc(m, line, pos, MAN_TAIL, tok);
+ if ( ! man_node_append(m, p))
+ return(0);
+ m->next = MAN_NEXT_CHILD;
+ return(1);
+}
+
+
+int
man_head_alloc(struct man *m, int line, int pos, enum mant tok)
{
struct man_node *p;
diff --git a/man.h b/man.h
index 64d8154b..3cf3e766 100644
--- a/man.h
+++ b/man.h
@@ -61,6 +61,7 @@ enum man_type {
MAN_BLOCK,
MAN_HEAD,
MAN_BODY,
+ MAN_TAIL,
MAN_TBL,
MAN_EQN
};
@@ -89,6 +90,7 @@ struct man_node {
enum man_type type; /* AST node type */
char *string; /* TEXT node argument */
struct man_node *head; /* BLOCK node HEAD ptr */
+ struct man_node *tail; /* BLOCK node TAIL ptr */
struct man_node *body; /* BLOCK node BODY ptr */
const struct tbl_span *span; /* TBL */
const struct eqn *eqn; /* EQN */
diff --git a/tree.c b/tree.c
index d53bbfc0..bf43242d 100644
--- a/tree.c
+++ b/tree.c
@@ -201,6 +201,9 @@ print_man(const struct man_node *n, int indent)
case (MAN_BODY):
t = "block-body";
break;
+ case (MAN_TAIL):
+ t = "block-tail";
+ break;
case (MAN_TBL):
t = "tbl";
break;
@@ -224,6 +227,8 @@ print_man(const struct man_node *n, int indent)
/* FALLTHROUGH */
case (MAN_HEAD):
/* FALLTHROUGH */
+ case (MAN_TAIL):
+ /* FALLTHROUGH */
case (MAN_BODY):
p = man_macronames[n->tok];
break;