Do not allow identifiers that start with a negative number.

Reported by Paul Hilfinger as a side effect of named references
support at
<http://lists.gnu.org/archive/html/bug-bison/2011-01/msg00000.html>.
Suggested by Paul Eggert.
* src/scan-code.l ({letter}, {id}): Adjust lexical definitions.
* src/scan-gram.l ({letter}, {id}): Likewise.
This commit is contained in:
Alex Rozenman
2011-01-05 15:47:25 +02:00
parent 9a4292e580
commit d236ad946b
3 changed files with 14 additions and 4 deletions

View File

@@ -1,3 +1,13 @@
2011-01-05 Alex Rozenman <rozenman@gmail.com>
Do not allow identifiers that start with a negative number.
Reported by Paul Hilfinger as a side effect of named references
support at
<http://lists.gnu.org/archive/html/bug-bison/2011-01/msg00000.html>.
Suggested by Paul Eggert.
* src/scan-code.l ({letter}, {id}): Adjust lexical definitions.
* src/scan-gram.l ({letter}, {id}): Likewise.
2011-01-03 Joel E. Denny <joeldenny@joeldenny.org>
* ChangeLog (2011-01-02): improve description.

View File

@@ -84,8 +84,8 @@ splice (\\[ \f\t\v]*\n)*
/* C style identifier. Must start with letter. Will be used for
named symbol references. Shall be kept synchronized with
scan-gram.l "letter" and "id". */
letter [-.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_]
id {letter}({letter}|[0-9])*
letter [.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_]
id -*(-|{letter}({letter}|[-0-9])*)
ref -?[0-9]+|{id}|"["{id}"]"|"$"
%%

View File

@@ -103,8 +103,8 @@ static void unexpected_newline (boundary, char const *);
/* Bracketed identifiers support. */
%x SC_BRACKETED_ID SC_RETURN_BRACKETED_ID
letter [-.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_]
id {letter}({letter}|[0-9])*
letter [.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_]
id -*(-|{letter}({letter}|[-0-9])*)
directive %{id}
int [0-9]+