version 1.113, 2017/05/05 13:17:55 |
version 1.117, 2018/12/14 05:18:02 |
|
|
/* $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 */ |
}; |
}; |
static const struct mdocarg *const mdocargs = __mdocargs - MDOC_Dd; |
|
|
|
|
|
/* |
/* |
Line 291 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 369 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 423 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 455 args(struct roff_man *mdoc, int line, int *pos, |
|
Line 453 args(struct roff_man *mdoc, int line, int *pos, |
|
if (buf[*pos] == '\0') { |
if (buf[*pos] == '\0') { |
if (mdoc->flags & MDOC_PHRASELIT && |
if (mdoc->flags & MDOC_PHRASELIT && |
! (mdoc->flags & MDOC_PHRASE)) { |
! (mdoc->flags & MDOC_PHRASE)) { |
mandoc_msg(MANDOCERR_ARG_QUOTE, |
mandoc_msg(MANDOCERR_ARG_QUOTE, line, *pos, NULL); |
mdoc->parse, line, *pos, NULL); |
|
mdoc->flags &= ~MDOC_PHRASELIT; |
mdoc->flags &= ~MDOC_PHRASELIT; |
} |
} |
return ARGS_EOLN; |
return ARGS_EOLN; |
Line 507 args(struct roff_man *mdoc, int line, int *pos, |
|
Line 504 args(struct roff_man *mdoc, int line, int *pos, |
|
p = strchr(*v, '\0'); |
p = strchr(*v, '\0'); |
if (p[-1] == ' ') |
if (p[-1] == ' ') |
mandoc_msg(MANDOCERR_SPACE_EOL, |
mandoc_msg(MANDOCERR_SPACE_EOL, |
mdoc->parse, line, *pos, NULL); |
line, *pos, NULL); |
*pos += (int)(p - *v); |
*pos += (int)(p - *v); |
} |
} |
|
|
Line 555 args(struct roff_man *mdoc, int line, int *pos, |
|
Line 552 args(struct roff_man *mdoc, int line, int *pos, |
|
if (buf[*pos] == '\0') { |
if (buf[*pos] == '\0') { |
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); |
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)++; |
|
|
if ('\0' == buf[*pos]) |
if ('\0' == buf[*pos]) |
mandoc_msg(MANDOCERR_SPACE_EOL, mdoc->parse, |
mandoc_msg(MANDOCERR_SPACE_EOL, line, *pos, NULL); |
line, *pos, NULL); |
|
|
|
return ARGS_QWORD; |
return ARGS_WORD; |
} |
} |
|
|
p = &buf[*pos]; |
p = &buf[*pos]; |