From: Alex Rozenman Date: Wed, 5 Jan 2011 13:47:25 +0000 (+0200) Subject: Do not allow identifiers that start with a negative number. X-Git-Tag: v2.5_rc1~41 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/d236ad946b61526197a5e20322416ad99b045d97 Do not allow identifiers that start with a negative number. Reported by Paul Hilfinger as a side effect of named references support at . Suggested by Paul Eggert. * src/scan-code.l ({letter}, {id}): Adjust lexical definitions. * src/scan-gram.l ({letter}, {id}): Likewise. --- diff --git a/ChangeLog b/ChangeLog index 8a273f9b..a7d8a764 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2011-01-05 Alex Rozenman + + Do not allow identifiers that start with a negative number. + Reported by Paul Hilfinger as a side effect of named references + support at + . + 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 * ChangeLog (2011-01-02): improve description. diff --git a/src/scan-code.l b/src/scan-code.l index 3603196c..e3e6b653 100644 --- a/src/scan-code.l +++ b/src/scan-code.l @@ -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}"]"|"$" %% diff --git a/src/scan-gram.l b/src/scan-gram.l index d7606d92..e1bda045 100644 --- a/src/scan-gram.l +++ b/src/scan-gram.l @@ -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]+