bug-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Do not allow identifiers that start with a negative number.


From: Alex Rozenman
Subject: [PATCH] Do not allow identifiers that start with a negative number.
Date: Wed, 5 Jan 2011 16:31:56 +0200

Hi

I pushed the following patch to master/branch-2.5:

commit d236ad946b61526197a5e20322416ad99b045d97
Author: Alex Rozenman <address@hidden>
Date:   Wed Jan 5 15:47:25 2011 +0200

    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.

diff --git a/ChangeLog b/ChangeLog
index 8a273f9..a7d8a76 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2011-01-05  Alex Rozenman  <address@hidden>
+
+       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  <address@hidden>

        * ChangeLog (2011-01-02): improve description.
diff --git a/src/scan-code.l b/src/scan-code.l
index 3603196..e3e6b65 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 d7606d9..e1bda04 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]+

Alex




On Wed, Jan 5, 2011 at 10:13 AM, Akim Demaille <address@hidden> wrote:

>
> Le 4 janv. 2011 à 22:51, Paul Eggert a écrit :
>
> > We can do this by using something like the following:
> >
> > letter  [.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_]
> > id      -*(-|{letter}({letter}|[-0-9])*)
> > ref     -?[0-9]+|{id}|"["{id}"]"|"$"
> >
> > and then "id" would be treated consistently everywhere.
>
> This is also my favorite option.




-- 
Best regards,
Alex Rozenman (address@hidden).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]