X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/e9690142325711b320ef444768fdd40a087d02f7..e436fa677c748f52929996590d3e46b5f984d6dc:/src/scan-gram.l diff --git a/src/scan-gram.l b/src/scan-gram.l index 3c38906f..d375fc12 100644 --- a/src/scan-gram.l +++ b/src/scan-gram.l @@ -1,6 +1,6 @@ /* Bison Grammar Scanner -*- C -*- - Copyright (C) 2002-2011 Free Software Foundation, Inc. + Copyright (C) 2002-2012 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -100,16 +100,16 @@ static void unexpected_newline (boundary, char const *); /* Strings and characters in directives/rules. */ %x SC_ESCAPED_STRING SC_ESCAPED_CHARACTER /* A identifier was just read in directives/rules. Special state - to capture the sequence `identifier :'. */ + to capture the sequence 'identifier :'. */ %x SC_AFTER_IDENTIFIER /* A complex tag, with nested angles brackets. */ %x SC_TAG /* Four types of user code: - - prologue (code between `%{' `%}' in the first section, before %%); + - prologue (code between '%{' '%}' in the first section, before %%); - actions, printers, union, etc, (between braced in the middle section); - - epilogue (everything after the second %%). - - predicate (code between `%?{' and `{' in middle section); */ + - epilogue (everything after the second %%). + - predicate (code between '%?{' and '{' in middle section); */ %x SC_PROLOGUE SC_BRACED_CODE SC_EPILOGUE SC_PREDICATE /* C and C++ comments in code. */ %x SC_COMMENT SC_LINE_COMMENT @@ -164,7 +164,7 @@ splice (\\[ \f\t\v]*\n)* { /* Comments and white space. */ - "," warn_at (*loc, _("stray `,' treated as white space")); + "," warn_at (*loc, _("stray ',' treated as white space")); [ \f\n\t\v] | "//".* ; "/*" { @@ -440,7 +440,7 @@ splice (\\[ \f\t\v]*\n)* /*---------------------------------------------------------------. - | Scanning a Yacc comment. The initial `/ *' is already eaten. | + | Scanning a Yacc comment. The initial '/ *' is already eaten. | `---------------------------------------------------------------*/ @@ -452,7 +452,7 @@ splice (\\[ \f\t\v]*\n)* /*------------------------------------------------------------. - | Scanning a C comment. The initial `/ *' is already eaten. | + | Scanning a C comment. The initial '/ *' is already eaten. | `------------------------------------------------------------*/ @@ -463,7 +463,7 @@ splice (\\[ \f\t\v]*\n)* /*--------------------------------------------------------------. - | Scanning a line comment. The initial `//' is already eaten. | + | Scanning a line comment. The initial '//' is already eaten. | `--------------------------------------------------------------*/ @@ -707,8 +707,8 @@ splice (\\[ \f\t\v]*\n)* "{"|"<"{splice}"%" STRING_GROW; nesting++; "%"{splice}">" STRING_GROW; nesting--; - /* Tokenize `<<%' correctly (as `<<' `%') rather than incorrrectly - (as `<' `<%'). */ + /* Tokenize '<<%' correctly (as '<<' '%') rather than incorrrectly + (as '<' '<%'). */ "<"{splice}"<" STRING_GROW; <> { @@ -933,7 +933,7 @@ convert_ucn_to_byte (char const *ucn) /*----------------------------------------------------------------. -| Handle `#line INT "FILE"'. ARGS has already skipped `#line '. | +| Handle '#line INT "FILE"'. ARGS has already skipped '#line '. | `----------------------------------------------------------------*/ static void @@ -941,8 +941,8 @@ handle_syncline (char *args, location loc) { char *after_num; unsigned long int lineno = strtoul (args, &after_num, 10); - char *file = mbschr (after_num, '"') + 1; - *mbschr (file, '"') = '\0'; + char *file = strchr (after_num, '"') + 1; + *strchr (file, '"') = '\0'; if (INT_MAX <= lineno) { warn_at (loc, _("line number overflow")); @@ -965,6 +965,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, "'\\''")) + token_end = "\"'\""; complain_at (loc, _(msgid), token_end); } @@ -977,7 +981,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 +992,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); }