mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
bison: catch bad symbol names.
* src/scan-gram.l({int}{id}): Report as an invalid identifier.
* tests/input.at: Adjust.
This commit is contained in:
@@ -1,8 +1,14 @@
|
||||
2009-05-04 Akim Demaille <demaille@gostai.com>
|
||||
|
||||
bison: catch bad symbol names.
|
||||
* src/scan-gram.l({int}{id}): Report as an invalid identifier.
|
||||
* tests/input.at: Adjust.
|
||||
|
||||
2009-05-04 Akim Demaille <demaille@gostai.com>
|
||||
|
||||
identifiers: dashes are letters.
|
||||
Dashes can now start identifiers (symbols and directives).
|
||||
|
||||
|
||||
* src/scan-gram.l ({letter}): Add dash.
|
||||
({id}): Remove it.
|
||||
* tests/input.at (Symbols): Adjust.
|
||||
|
||||
@@ -240,6 +240,12 @@ splice (\\[ \f\t\v]*\n)*
|
||||
return INT;
|
||||
}
|
||||
|
||||
/* Identifiers may not start with a digit. Yet, don't silently
|
||||
accept "1FOO" as "1 FOO". */
|
||||
{int}{id} {
|
||||
complain_at (*loc, _("invalid identifier: %s"), quote (yytext));
|
||||
}
|
||||
|
||||
/* Characters. We don't check there is only one. */
|
||||
"'" STRING_GROW; token_start = loc->start; BEGIN SC_ESCAPED_CHARACTER;
|
||||
|
||||
|
||||
@@ -657,13 +657,13 @@ AT_COMPILE([input.o], [-c input.c])
|
||||
# Digits cannot.
|
||||
AT_DATA_GRAMMAR([input.y],
|
||||
[[%token .GOOD
|
||||
%token -GOOD
|
||||
%token 1NV4L1D
|
||||
-GOOD
|
||||
1NV4L1D
|
||||
%%
|
||||
start: .GOOD -GOOD
|
||||
]])
|
||||
AT_BISON_CHECK([-o input.c input.y], [1], [],
|
||||
[[input.y:11.8: syntax error, unexpected integer, expecting char or identifier or <tag>
|
||||
[[input.y:11.10-16: invalid identifier: `1NV4L1D'
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
Reference in New Issue
Block a user