diff options
-rw-r--r-- | eqn.c | 2 | ||||
-rw-r--r-- | man.c | 9 | ||||
-rw-r--r-- | man_validate.c | 3 | ||||
-rw-r--r-- | mandoc.c | 4 | ||||
-rw-r--r-- | mandoc.h | 15 | ||||
-rw-r--r-- | mdoc.c | 12 | ||||
-rw-r--r-- | mdoc_argv.c | 12 | ||||
-rw-r--r-- | mdoc_validate.c | 3 | ||||
-rw-r--r-- | read.c | 11 | ||||
-rw-r--r-- | roff.c | 24 |
10 files changed, 55 insertions, 40 deletions
@@ -768,7 +768,7 @@ again: ep->cur++; } else { if (q) - EQN_MSG(MANDOCERR_BADQUOTE, ep); + EQN_MSG(MANDOCERR_ARG_QUOTE, ep); next = strchr(start, '\0'); *sz = (size_t)(next - start); ep->cur += *sz; @@ -447,7 +447,8 @@ man_ptext(struct man *man, int line, char *buf, int offs) if (' ' == buf[i - 1] || '\t' == buf[i - 1]) { if (i > 1 && '\\' != buf[i - 2]) - man_pmsg(man, line, i - 1, MANDOCERR_EOLNSPACE); + mandoc_msg(MANDOCERR_SPACE_EOL, man->parse, + line, i - 1, NULL); for (--i; i && ' ' == buf[i]; i--) /* Spin back to non-space. */ ; @@ -483,7 +484,8 @@ man_pmacro(struct man *man, int ln, char *buf, int offs) struct man_node *n; if ('"' == buf[offs]) { - man_pmsg(man, ln, offs, MANDOCERR_BADCOMMENT); + mandoc_msg(MANDOCERR_COMMENT_BAD, man->parse, + ln, offs, NULL); return(1); } else if ('\0' == buf[offs]) return(1); @@ -521,7 +523,8 @@ man_pmacro(struct man *man, int ln, char *buf, int offs) */ if ('\0' == buf[offs] && ' ' == buf[offs - 1]) - man_pmsg(man, ln, offs - 1, MANDOCERR_EOLNSPACE); + mandoc_msg(MANDOCERR_SPACE_EOL, man->parse, + ln, offs - 1, NULL); /* * Remove prior ELINE macro, as it's being clobbered by a new diff --git a/man_validate.c b/man_validate.c index 4303ad33..cd776387 100644 --- a/man_validate.c +++ b/man_validate.c @@ -230,7 +230,8 @@ check_text(CHKARGS) cp = n->string; for (p = cp; NULL != (p = strchr(p, '\t')); p++) - man_pmsg(man, n->line, (int)(p - cp), MANDOCERR_BADTAB); + mandoc_msg(MANDOCERR_FI_TAB, man->parse, + n->line, n->pos + (p - cp), NULL); } #define INEQ_DEFINE(x, ineq, name) \ @@ -429,7 +429,7 @@ mandoc_getarg(struct mparse *parse, char **cpp, int ln, int *pos) /* Quoted argument without a closing quote. */ if (1 == quoted) - mandoc_msg(MANDOCERR_BADQUOTE, parse, ln, *pos, NULL); + mandoc_msg(MANDOCERR_ARG_QUOTE, parse, ln, *pos, NULL); /* NUL-terminate this argument and move to the next one. */ if (pairs) @@ -443,7 +443,7 @@ mandoc_getarg(struct mparse *parse, char **cpp, int ln, int *pos) *cpp = cp; if ('\0' == *cp && (white || ' ' == cp[-1])) - mandoc_msg(MANDOCERR_EOLNSPACE, parse, ln, *pos, NULL); + mandoc_msg(MANDOCERR_SPACE_EOL, parse, ln, *pos, NULL); return(start); } @@ -98,8 +98,9 @@ enum mandocerr { MANDOCERR_BF_BADFONT, /* unknown font type, using \fR: macro font */ MANDOCERR_ARG_STD, /* missing -std argument, adding it: macro */ - /* related to bad macro arguments */ + /* related to bad arguments */ MANDOCERR_IGNARGV, /* skipping argument */ + MANDOCERR_ARG_QUOTE, /* unterminated quoted argument */ MANDOCERR_ARG_REP, /* duplicate argument: macro arg */ MANDOCERR_BD_REP, /* skipping duplicate display type: type */ MANDOCERR_BL_REP, /* skipping duplicate list type: type */ @@ -108,12 +109,12 @@ enum mandocerr { MANDOCERR_FT_BAD, /* unknown font, skipping request: request font */ /* related to plain text */ - MANDOCERR_NOBLANKLN, /* blank line in non-literal context */ - MANDOCERR_BADTAB, /* tab in non-literal context */ - MANDOCERR_EOLNSPACE, /* end of line whitespace */ - MANDOCERR_BADCOMMENT, /* bad comment style */ - MANDOCERR_BADESCAPE, /* bad escape sequence */ - MANDOCERR_BADQUOTE, /* unterminated quoted string */ + MANDOCERR_FI_BLANK, /* blank line in fill mode, using .sp */ + MANDOCERR_FI_TAB, /* tab in filled text */ + MANDOCERR_SPACE_EOL, /* whitespace at end of input line */ + MANDOCERR_COMMENT_BAD, /* bad comment style */ + MANDOCERR_ESC_BAD, /* invalid escape sequence: esc */ + MANDOCERR_STR_UNDEF, /* undefined string, using "": name */ MANDOCERR_ERROR, /* ===== start of errors ===== */ @@ -797,10 +797,12 @@ mdoc_ptext(struct mdoc *mdoc, int line, char *buf, int offs) *end = '\0'; if (ws) - mdoc_pmsg(mdoc, line, (int)(ws-buf), MANDOCERR_EOLNSPACE); + mandoc_msg(MANDOCERR_SPACE_EOL, mdoc->parse, + line, (int)(ws-buf), NULL); if ('\0' == buf[offs] && ! (MDOC_LITERAL & mdoc->flags)) { - mdoc_pmsg(mdoc, line, (int)(c-buf), MANDOCERR_NOBLANKLN); + mandoc_msg(MANDOCERR_FI_BLANK, mdoc->parse, + line, (int)(c - buf), NULL); /* * Insert a `sp' in the case of a blank line. Technically, @@ -850,7 +852,8 @@ mdoc_pmacro(struct mdoc *mdoc, int ln, char *buf, int offs) /* Empty post-control lines are ignored. */ if ('"' == buf[offs]) { - mdoc_pmsg(mdoc, ln, offs, MANDOCERR_BADCOMMENT); + mandoc_msg(MANDOCERR_COMMENT_BAD, mdoc->parse, + ln, offs, NULL); return(1); } else if ('\0' == buf[offs]) return(1); @@ -893,7 +896,8 @@ mdoc_pmacro(struct mdoc *mdoc, int ln, char *buf, int offs) */ if ('\0' == buf[offs] && ' ' == buf[offs - 1]) - mdoc_pmsg(mdoc, ln, offs - 1, MANDOCERR_EOLNSPACE); + mandoc_msg(MANDOCERR_SPACE_EOL, mdoc->parse, + ln, offs - 1, NULL); /* * If an initial macro or a list invocation, divert directly diff --git a/mdoc_argv.c b/mdoc_argv.c index 7e3b1fe1..99c0caaf 100644 --- a/mdoc_argv.c +++ b/mdoc_argv.c @@ -461,7 +461,8 @@ args(struct mdoc *mdoc, int line, int *pos, * is unterminated. */ if (MDOC_PHRASELIT & mdoc->flags) - mdoc_pmsg(mdoc, line, *pos, MANDOCERR_BADQUOTE); + mandoc_msg(MANDOCERR_ARG_QUOTE, + mdoc->parse, line, *pos, NULL); mdoc->flags &= ~MDOC_PHRASELIT; return(ARGS_EOLN); @@ -520,7 +521,8 @@ args(struct mdoc *mdoc, int line, int *pos, /* Whitespace check for eoln case... */ if ('\0' == *p && ' ' == *(p - 1)) - mdoc_pmsg(mdoc, line, *pos, MANDOCERR_EOLNSPACE); + mandoc_msg(MANDOCERR_SPACE_EOL, mdoc->parse, + line, *pos, NULL); *pos += (int)(p - *v); @@ -575,7 +577,8 @@ args(struct mdoc *mdoc, int line, int *pos, if ('\0' == buf[*pos]) { if (MDOC_PPHRASE & mdoc->flags) return(ARGS_QWORD); - mdoc_pmsg(mdoc, line, *pos, MANDOCERR_BADQUOTE); + mandoc_msg(MANDOCERR_ARG_QUOTE, + mdoc->parse, line, *pos, NULL); return(ARGS_QWORD); } @@ -589,7 +592,8 @@ args(struct mdoc *mdoc, int line, int *pos, (*pos)++; if ('\0' == buf[*pos]) - mdoc_pmsg(mdoc, line, *pos, MANDOCERR_EOLNSPACE); + mandoc_msg(MANDOCERR_SPACE_EOL, mdoc->parse, + line, *pos, NULL); return(ARGS_QWORD); } diff --git a/mdoc_validate.c b/mdoc_validate.c index fb927fd2..48bb9c2c 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -551,7 +551,8 @@ check_text(struct mdoc *mdoc, int ln, int pos, char *p) return; for (cp = p; NULL != (p = strchr(p, '\t')); p++) - mdoc_pmsg(mdoc, ln, pos + (int)(p - cp), MANDOCERR_BADTAB); + mandoc_msg(MANDOCERR_FI_TAB, mdoc->parse, + ln, pos + (int)(p - cp), NULL); } static int @@ -144,6 +144,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { /* related to bad macro arguments */ "skipping argument", + "unterminated quoted argument", "duplicate argument", "skipping duplicate display type", "skipping duplicate list type", @@ -152,12 +153,12 @@ static const char * const mandocerrs[MANDOCERR_MAX] = { "unknown font, skipping request", /* related to plain text */ - "blank line in non-literal context", - "tab in non-literal context", - "end of line whitespace", + "blank line in fill mode, using .sp", + "tab in filled text", + "whitespace at end of input line", "bad comment style", - "bad escape sequence", - "unterminated quoted string", + "invalid escape sequence", + "undefined string, using \"\"", "generic error", @@ -542,8 +542,9 @@ roff_res(struct roff *r, char **bufp, size_t *szp, int ln, int pos) break; default: if (ESCAPE_ERROR == mandoc_escape(&cp, NULL, NULL)) - mandoc_msg(MANDOCERR_BADESCAPE, r->parse, - ln, (int)(stesc - *bufp), NULL); + mandoc_vmsg(MANDOCERR_ESC_BAD, + r->parse, ln, (int)(stesc - *bufp), + "%.*s", (int)(cp - stesc), stesc); continue; } @@ -588,8 +589,8 @@ roff_res(struct roff *r, char **bufp, size_t *szp, int ln, int pos) arg_complete = 1; for (naml = 0; 0 == maxl || naml < maxl; naml++, cp++) { if ('\0' == *cp) { - mandoc_msg(MANDOCERR_BADESCAPE, r->parse, - ln, (int)(stesc - *bufp), NULL); + mandoc_msg(MANDOCERR_ESC_BAD, r->parse, + ln, (int)(stesc - *bufp), stesc); arg_complete = 0; break; } @@ -631,8 +632,9 @@ roff_res(struct roff *r, char **bufp, size_t *szp, int ln, int pos) } if (NULL == res) { - mandoc_msg(MANDOCERR_BADESCAPE, r->parse, - ln, (int)(stesc - *bufp), NULL); + mandoc_vmsg(MANDOCERR_STR_UNDEF, + r->parse, ln, (int)(stesc - *bufp), + "%.*s", (int)naml, stnam); res = ""; } @@ -1894,9 +1896,8 @@ roff_tr(ROFF_ARGS) if ('\\' == *first) { esc = mandoc_escape(&p, NULL, NULL); if (ESCAPE_ERROR == esc) { - mandoc_msg(MANDOCERR_BADESCAPE, - r->parse, ln, - (int)(p - *bufp), NULL); + mandoc_msg(MANDOCERR_ESC_BAD, r->parse, + ln, (int)(p - *bufp), first); return(ROFF_IGN); } fsz = (size_t)(p - first); @@ -1906,9 +1907,8 @@ roff_tr(ROFF_ARGS) if ('\\' == *second) { esc = mandoc_escape(&p, NULL, NULL); if (ESCAPE_ERROR == esc) { - mandoc_msg(MANDOCERR_BADESCAPE, - r->parse, ln, - (int)(p - *bufp), NULL); + mandoc_msg(MANDOCERR_ESC_BAD, r->parse, + ln, (int)(p - *bufp), second); return(ROFF_IGN); } ssz = (size_t)(p - second); |