From e0319547b634212e3ac7b2ed3651be9808ea1399 Mon Sep 17 00:00:00 2001 From: Alex Rozenman Date: Wed, 5 Jan 2011 15:47:25 +0200 Subject: [PATCH] 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. --- ChangeLog | 10 ++++++++++ src/scan-code.l | 4 ++-- src/scan-gram.l | 4 ++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6d833219..b23c9715 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 a5f570d7..ffc8b5d4 100644 --- a/src/scan-code.l +++ b/src/scan-code.l @@ -85,8 +85,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 b3a50988..41291812 100644 --- a/src/scan-gram.l +++ b/src/scan-gram.l @@ -118,8 +118,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]+ -- 2.45.2