diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-03-08 11:41:22 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-03-08 11:41:22 +0000 |
commit | 056d0c68fbd56e3ce25fe3ad8c58ade0ab30a1b4 (patch) | |
tree | a2b977b6c334b960dc3df02e4f402667e9314030 /mdoc.h | |
parent | 7024ee7ca35a8033dee9ec0936cd2f3e0251aca2 (diff) | |
download | mandoc-056d0c68fbd56e3ce25fe3ad8c58ade0ab30a1b4.tar.gz |
BROKEN CHECK-IN. Wide-ranging updates.
Removed libmdoc internal argv limit (all dynamic).
Removed "data" union in mdoc_node (to be selectively re-added).
Diffstat (limited to 'mdoc.h')
-rw-r--r-- | mdoc.h | 52 |
1 files changed, 20 insertions, 32 deletions
@@ -173,15 +173,6 @@ enum mdoc_warn { WARN_COMPAT }; -/* An argument to a macro (multiple values = `It -column'). */ -struct mdoc_arg { - int arg; - int line; - int pos; - size_t sz; - char **value; -}; - /* Type of a syntax node. */ enum mdoc_type { MDOC_TEXT, @@ -229,31 +220,19 @@ struct mdoc_meta { char *name; }; -/* Text-only node. */ -struct mdoc_text { - char *string; -}; - -/* Block (scoped) node. */ -struct mdoc_block { - size_t argc; - struct mdoc_arg *argv; - struct mdoc_node *head; - struct mdoc_node *body; - struct mdoc_node *tail; +/* An argument to a macro (multiple values = `It -column'). */ +struct mdoc_argv { + int arg; + int line; + int pos; + size_t sz; + char **value; }; -/* In-line element node. */ -struct mdoc_elem { +struct mdoc_arg { size_t argc; - struct mdoc_arg *argv; -}; - -/* Typed nodes of an AST node. */ -union mdoc_data { - struct mdoc_text text; - struct mdoc_elem elem; - struct mdoc_block block; + struct mdoc_argv *argv; + unsigned int refcnt; }; /* Node in AST. */ @@ -269,10 +248,16 @@ struct mdoc_node { #define MDOC_VALID (1 << 0) #define MDOC_ACTED (1 << 1) enum mdoc_type type; - union mdoc_data data; enum mdoc_sec sec; + struct mdoc_arg *args; /* BLOCK/ELEM */ + struct mdoc_node *head; /* BLOCK */ + struct mdoc_node *body; /* BLOCK */ + struct mdoc_node *tail; /* BLOCK */ + char *string; /* TEXT */ }; +#define MDOC_IGN_SCOPE (1 << 0) + /* Call-backs for parse messages. */ struct mdoc_cb { void (*mdoc_msg)(void *, int, int, const char *); @@ -297,6 +282,9 @@ void mdoc_free(struct mdoc *); /* Allocate a new parser instance. */ struct mdoc *mdoc_alloc(void *data, const struct mdoc_cb *); +/* Set parse options. */ +void mdoc_setflags(struct mdoc *, int); + /* Parse a single line in a stream (boolean retval). */ int mdoc_parseln(struct mdoc *, int, char *buf); |