X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/9874f80b2e813a8ad8e5562dbbaa30ecafd5e7d8..63951be29fcb8e21146a9377176d53d509c575ca:/src/scan-gram.l diff --git a/src/scan-gram.l b/src/scan-gram.l index 81127f88..ad061cc6 100644 --- a/src/scan-gram.l +++ b/src/scan-gram.l @@ -36,7 +36,7 @@ #include "reader.h" #include "uniqstr.h" -#include +#include #include #include @@ -291,7 +291,7 @@ splice (\\[ \f\t\v]*\n)* } . { - complain_at (*loc, _("invalid character: %s"), quote (yytext)); + complain_at (*loc, _("invalid character: %s"), quote_mem (yytext, yyleng)); } <> { @@ -375,7 +375,7 @@ splice (\\[ \f\t\v]*\n)* } . { complain_at (*loc, _("invalid character in bracketed name: %s"), - quote (yytext)); + quote_mem (yytext, yyleng)); } <> { BEGIN bracketed_id_context_state; @@ -560,7 +560,7 @@ splice (\\[ \f\t\v]*\n)* \\(.|\n) { char const *p = yytext + 1; /* Quote only if escaping won't make the character visible. */ - if (isspace ((unsigned char) *p) && isprint ((unsigned char) *p)) + if (c_isspace ((unsigned char) *p) && c_isprint ((unsigned char) *p)) p = quote (p); else p = quotearg_style_mem (escape_quoting_style, p, 1); @@ -872,6 +872,10 @@ unexpected_end (boundary start, char const *msgid, char const *token_end) location loc; loc.start = start; loc.end = scanner_cursor; + token_end = quote (token_end); + // Instead of '\'', display "'". + if (!strcmp (token_end, "'\\''")) + token_end = "\"'\""; complain_at (loc, _(msgid), token_end); } @@ -884,7 +888,7 @@ unexpected_end (boundary start, char const *msgid, char const *token_end) static void unexpected_eof (boundary start, char const *token_end) { - unexpected_end (start, N_("missing '%s' at end of file"), token_end); + unexpected_end (start, N_("missing %s at end of file"), token_end); } @@ -895,7 +899,7 @@ unexpected_eof (boundary start, char const *token_end) static void unexpected_newline (boundary start, char const *token_end) { - unexpected_end (start, N_("missing '%s' at end of line"), token_end); + unexpected_end (start, N_("missing %s at end of line"), token_end); }