diff options
-rw-r--r-- | argv.c | 55 | ||||
-rw-r--r-- | macro.c | 16 | ||||
-rw-r--r-- | mdoc.c | 9 | ||||
-rw-r--r-- | mdoc.h | 4 | ||||
-rw-r--r-- | prologue.c | 3 | ||||
-rw-r--r-- | validate.c | 6 |
6 files changed, 50 insertions, 43 deletions
@@ -133,6 +133,22 @@ lookup(int tok, const char *argv) { switch (tok) { + case (MDOC_Bf): + if (xstrcmp(argv, "emphasis")) + return(MDOC_Emphasis); + else if (xstrcmp(argv, "literal")) + return(MDOC_Literal); + else if (xstrcmp(argv, "symbolic")) + return(MDOC_Symbolic); + break; + + case (MDOC_An): + if (xstrcmp(argv, "split")) + return(MDOC_Split); + else if (xstrcmp(argv, "nosplit")) + return(MDOC_Nosplit); + break; + case (MDOC_Bd): if (xstrcmp(argv, "ragged")) return(MDOC_Ragged); @@ -307,39 +323,6 @@ parse(struct mdoc *mdoc, int tok, ppos = *pos; switch (v->arg) { - case(MDOC_Compact): - /* FALLTHROUGH */ - case(MDOC_Ragged): - /* FALLTHROUGH */ - case(MDOC_Unfilled): - /* FALLTHROUGH */ - case(MDOC_Literal): - /* FALLTHROUGH */ - case(MDOC_File): - /* FALLTHROUGH */ - case(MDOC_Bullet): - /* FALLTHROUGH */ - case(MDOC_Dash): - /* FALLTHROUGH */ - case(MDOC_Hyphen): - /* FALLTHROUGH */ - case(MDOC_Item): - /* FALLTHROUGH */ - case(MDOC_Enum): - /* FALLTHROUGH */ - case(MDOC_Tag): - /* FALLTHROUGH */ - case(MDOC_Diag): - /* FALLTHROUGH */ - case(MDOC_Hang): - /* FALLTHROUGH */ - case(MDOC_Ohang): - /* FALLTHROUGH */ - case(MDOC_Inset): - v->sz = 0; - v->value = NULL; - break; - case(MDOC_Std): /* FALLTHROUGH */ case(MDOC_Width): @@ -384,9 +367,11 @@ parse(struct mdoc *mdoc, int tok, v->sz = i; break; + default: - abort(); - /* NOTREACHED */ + v->sz = 0; + v->value = NULL; + break; } return(1); @@ -146,6 +146,15 @@ append_text_argv(struct mdoc *mdoc, int tok, int pos, if ( ! mdoc_valid_pre(mdoc, tok, pos, 0, NULL, argc, argv)) return(0); + + switch (tok) { + case (MDOC_Pf): + /* TODO: only use first two arguments in element. */ + break; + default: + break; + } + mdoc_elem_alloc(mdoc, pos, tok, (size_t)argc, argv, (size_t)sz, _CC(args)); mdoc->next = MDOC_NEXT_SIBLING; @@ -332,6 +341,9 @@ macro_close_explicit(MACRO_PROT_ARGS) case (MDOC_Re): tt = MDOC_Rs; break; + case (MDOC_Ef): + tt = MDOC_Bf; + break; default: abort(); /* NOTREACHED */ @@ -542,6 +554,10 @@ again: } +/* + * FIXME: like in with macro_constant, have the append_ routine chop the + * number of requisite arguments (this is ugly when done in-line). + */ int macro_constant_delimited(MACRO_PROT_ARGS) { @@ -80,6 +80,7 @@ const char *const __mdoc_argnames[MDOC_ARG_MAX] = { "xsh5", "xns5", "xns5.2d2.0", "xcurses4.2", "susv2", "susv3", "svid4", "filled", "words", + "emphasis", "symbolic", }; const struct mdoc_macro __mdoc_macros[MDOC_MAX] = { @@ -98,7 +99,7 @@ const struct mdoc_macro __mdoc_macros[MDOC_MAX] = { { macro_close_explicit, 0 }, /* El */ { NULL, 0 }, /* It */ { macro_text, MDOC_CALLABLE }, /* Ad */ - { NULL, 0 }, /* An */ + { macro_constant, 0 }, /* An */ { macro_text, MDOC_CALLABLE }, /* Ar */ { macro_constant, MDOC_QUOTABLE }, /* Cd */ { macro_text, MDOC_CALLABLE }, /* Cm */ @@ -140,7 +141,7 @@ const struct mdoc_macro __mdoc_macros[MDOC_MAX] = { { macro_scoped_line, MDOC_CALLABLE }, /* Aq */ { macro_constant, 0 }, /* At */ { NULL, 0 }, /* Bc */ - { NULL, 0 }, /* Bf */ + { macro_scoped, 0 }, /* Bf */ { NULL, 0 }, /* Bo */ { macro_scoped_line, MDOC_CALLABLE }, /* Bq */ { macro_constant_delimited, 0 }, /* Bsx */ @@ -150,7 +151,7 @@ const struct mdoc_macro __mdoc_macros[MDOC_MAX] = { { NULL, 0 }, /* Do */ { macro_scoped_line, MDOC_CALLABLE }, /* Dq */ { NULL, 0 }, /* Ec */ - { NULL, 0 }, /* Ef */ + { macro_close_explicit, 0 }, /* Ef */ { macro_text, MDOC_CALLABLE }, /* Em */ { NULL, 0 }, /* Eo */ { macro_constant_delimited, 0 }, /* Fx */ @@ -160,7 +161,7 @@ const struct mdoc_macro __mdoc_macros[MDOC_MAX] = { { macro_constant_delimited, 0 }, /* Nx */ { macro_constant_delimited, 0 }, /* Ox */ { NULL, 0 }, /* Pc */ - { NULL, 0 }, /* Pf */ + { macro_constant, 0 }, /* Pf */ { NULL, 0 }, /* Po */ { macro_scoped_line, MDOC_CALLABLE }, /* Pq */ { NULL, 0 }, /* Qc */ @@ -189,7 +189,9 @@ #define MDOC_svid4 57 #define MDOC_Filled 58 #define MDOC_Words 59 -#define MDOC_ARG_MAX 60 +#define MDOC_Emphasis 60 +#define MDOC_Symbolic 61 +#define MDOC_ARG_MAX 62 enum mdoc_err { ERR_SYNTAX_QUOTE, /* NOTUSED */ @@ -18,6 +18,9 @@ */ #include <assert.h> #include <stdlib.h> +#ifdef __linux__ +#include <time.h> +#endif #include "private.h" @@ -81,7 +81,7 @@ const struct valids mdoc_valids[MDOC_MAX] = { { NULL, NULL, no_head_child }, /* El */ { NULL, NULL, NULL }, /* It */ { need_ge1, NULL, NULL }, /* Ad */ - { NULL, NULL, NULL }, /* An */ + { NULL, NULL, NULL }, /* An */ /* FIXME: no args & argv. */ { NULL, NULL, NULL }, /* Ar */ { need_ge1, NULL, NULL }, /* Cd */ { NULL, NULL, NULL }, /* Cm */ @@ -133,7 +133,7 @@ const struct valids mdoc_valids[MDOC_MAX] = { { NULL, NULL, NULL }, /* Do */ { NULL, NULL, NULL }, /* Dq */ { NULL, NULL, NULL }, /* Ec */ - { NULL, NULL, NULL }, /* Ef */ + { NULL, NULL, NULL }, /* Ef */ /* -symbolic, etc. */ { need_ge1, NULL, NULL }, /* Em */ { NULL, NULL, NULL }, /* Eo */ { assert_le1, NULL, NULL }, /* Fx */ @@ -143,7 +143,7 @@ const struct valids mdoc_valids[MDOC_MAX] = { { assert_le1, NULL, NULL }, /* Nx */ { assert_le1, NULL, NULL }, /* Ox */ { NULL, NULL, NULL }, /* Pc */ - { NULL, NULL, NULL }, /* Pf */ + { NULL, NULL, NULL }, /* Pf */ /* 2 or more arguments */ { NULL, NULL, NULL }, /* Po */ { NULL, NULL, NULL }, /* Pq */ { NULL, NULL, NULL }, /* Qc */ |