version 1.112, 2017/05/04 17:48:29 |
version 1.116, 2018/08/17 20:33:37 |
|
|
/* $Id$ */ |
/* $Id$ */ |
/* |
/* |
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2012, 2014-2017 Ingo Schwarze <schwarze@openbsd.org> |
* Copyright (c) 2012, 2014-2018 Ingo Schwarze <schwarze@openbsd.org> |
* |
* |
* Permission to use, copy, modify, and distribute this software for any |
* Permission to use, copy, modify, and distribute this software for any |
* purpose with or without fee is hereby granted, provided that the above |
* purpose with or without fee is hereby granted, provided that the above |
Line 144 static const enum mdocargt args_Bl[] = { |
|
Line 144 static const enum mdocargt args_Bl[] = { |
|
MDOC_ARG_MAX |
MDOC_ARG_MAX |
}; |
}; |
|
|
static const struct mdocarg __mdocargs[MDOC_MAX - MDOC_Dd] = { |
static const struct mdocarg mdocargs[MDOC_MAX - MDOC_Dd] = { |
{ ARGSFL_NONE, NULL }, /* Dd */ |
{ ARGSFL_NONE, NULL }, /* Dd */ |
{ ARGSFL_NONE, NULL }, /* Dt */ |
{ ARGSFL_NONE, NULL }, /* Dt */ |
{ ARGSFL_NONE, NULL }, /* Os */ |
{ ARGSFL_NONE, NULL }, /* Os */ |
Line 263 static const struct mdocarg __mdocargs[MDOC_MAX - MDOC |
|
Line 263 static const struct mdocarg __mdocargs[MDOC_MAX - MDOC |
|
{ ARGSFL_DELIM, NULL }, /* En */ |
{ ARGSFL_DELIM, NULL }, /* En */ |
{ ARGSFL_DELIM, NULL }, /* Dx */ |
{ ARGSFL_DELIM, NULL }, /* Dx */ |
{ ARGSFL_NONE, NULL }, /* %Q */ |
{ ARGSFL_NONE, NULL }, /* %Q */ |
{ ARGSFL_NONE, NULL }, /* sp */ |
|
{ ARGSFL_NONE, NULL }, /* %U */ |
{ ARGSFL_NONE, NULL }, /* %U */ |
{ ARGSFL_NONE, NULL }, /* Ta */ |
{ ARGSFL_NONE, NULL }, /* Ta */ |
{ ARGSFL_NONE, NULL }, /* ll */ |
|
}; |
}; |
static const struct mdocarg *const mdocargs = __mdocargs - MDOC_Dd; |
|
|
|
|
|
/* |
/* |
Line 292 mdoc_argv(struct roff_man *mdoc, int line, enum roff_t |
|
Line 289 mdoc_argv(struct roff_man *mdoc, int line, enum roff_t |
|
/* Which flags does this macro support? */ |
/* Which flags does this macro support? */ |
|
|
assert(tok >= MDOC_Dd && tok < MDOC_MAX); |
assert(tok >= MDOC_Dd && tok < MDOC_MAX); |
argtable = mdocargs[tok].argvs; |
argtable = mdocargs[tok - MDOC_Dd].argvs; |
if (argtable == NULL) |
if (argtable == NULL) |
return; |
return; |
|
|
Line 370 mdoc_argv(struct roff_man *mdoc, int line, enum roff_t |
|
Line 367 mdoc_argv(struct roff_man *mdoc, int line, enum roff_t |
|
/* Prepare for parsing the next flag. */ |
/* Prepare for parsing the next flag. */ |
|
|
*pos = ipos; |
*pos = ipos; |
argtable = mdocargs[tok].argvs; |
argtable = mdocargs[tok - MDOC_Dd].argvs; |
} |
} |
} |
} |
|
|
Line 424 mdoc_args(struct roff_man *mdoc, int line, int *pos, |
|
Line 421 mdoc_args(struct roff_man *mdoc, int line, int *pos, |
|
|
|
if (v == NULL) |
if (v == NULL) |
v = &v_local; |
v = &v_local; |
fl = tok == TOKEN_NONE ? ARGSFL_NONE : mdocargs[tok].flags; |
fl = tok == TOKEN_NONE ? ARGSFL_NONE : mdocargs[tok - MDOC_Dd].flags; |
|
|
/* |
/* |
* We know that we're in an `It', so it's reasonable to expect |
* We know that we're in an `It', so it's reasonable to expect |
Line 557 args(struct roff_man *mdoc, int line, int *pos, |
|
Line 554 args(struct roff_man *mdoc, int line, int *pos, |
|
if ( ! (mdoc->flags & MDOC_PHRASE)) |
if ( ! (mdoc->flags & MDOC_PHRASE)) |
mandoc_msg(MANDOCERR_ARG_QUOTE, |
mandoc_msg(MANDOCERR_ARG_QUOTE, |
mdoc->parse, line, *pos, NULL); |
mdoc->parse, line, *pos, NULL); |
return ARGS_QWORD; |
return ARGS_WORD; |
} |
} |
|
|
mdoc->flags &= ~MDOC_PHRASELIT; |
mdoc->flags &= ~MDOC_PHRASELIT; |
buf[(*pos)++] = '\0'; |
buf[(*pos)++] = '\0'; |
|
|
if ('\0' == buf[*pos]) |
if ('\0' == buf[*pos]) |
return ARGS_QWORD; |
return ARGS_WORD; |
|
|
while (' ' == buf[*pos]) |
while (' ' == buf[*pos]) |
(*pos)++; |
(*pos)++; |
Line 573 args(struct roff_man *mdoc, int line, int *pos, |
|
Line 570 args(struct roff_man *mdoc, int line, int *pos, |
|
mandoc_msg(MANDOCERR_SPACE_EOL, mdoc->parse, |
mandoc_msg(MANDOCERR_SPACE_EOL, mdoc->parse, |
line, *pos, NULL); |
line, *pos, NULL); |
|
|
return ARGS_QWORD; |
return ARGS_WORD; |
} |
} |
|
|
p = &buf[*pos]; |
p = &buf[*pos]; |