summaryrefslogtreecommitdiff
path: root/src/scan-gram.l
diff options
context:
space:
mode:
authorAkim Demaille <demaille@gostai.com>2012-02-08 10:28:58 +0100
committerAkim Demaille <demaille@gostai.com>2012-02-08 11:32:36 +0100
commit4a9cd8f24abba232b4a07ccdda4c6f109d27acac (patch)
treed418ca00f576cc3027bc2d3f98ca9293362d7d37 /src/scan-gram.l
parent62a87154b3bb1af77ee153603972090a600bafce (diff)
downloadbison-4a9cd8f24abba232b4a07ccdda4c6f109d27acac.tar.gz
use a more consistent quoting style.
See <http://lists.gnu.org/archive/html/bug-bison/2012-01/msg00120.html>. Use quotearg as often as possible instead of leaving the choice of the quotes to the translators. Use shorter messages. Factor similar messages to a single format, to make localization easier. * src/files.c, src/getargs.c, src/muscle-tab.c, src/reader.c * src/scan-code.l, src/scan-gram.l, src/symtab.c: Use quote() or quotearg_colon() on printf arguments instead of quotes in the format string. * data/bison.m4: Keep sync with the changes in muscle-tab.c. * tests/skeletons.at, tests/input.at, tests/regression.at: Adjust expected messages.
Diffstat (limited to 'src/scan-gram.l')
-rw-r--r--src/scan-gram.l9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/scan-gram.l b/src/scan-gram.l
index 449fbea9..e2e08f9a 100644
--- a/src/scan-gram.l
+++ b/src/scan-gram.l
@@ -39,6 +39,7 @@
#include <ctype.h>
#include <mbswidth.h>
#include <quote.h>
+#include <streq.h>
#include <src/scan-gram.h>
@@ -965,6 +966,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 (STREQ (token_end, "'\\''", '\'', '\\', '\'', '\'', 0,0,0,0,0))
+ token_end = "\"'\"";
complain_at (loc, _(msgid), token_end);
}
@@ -977,7 +982,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);
}
@@ -988,7 +993,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);
}