]> git.saurik.com Git - bison.git/commitdiff
flex: don't trust YY_USER_INIT
authorAkim Demaille <akim@lrde.epita.fr>
Wed, 31 Dec 2014 13:48:13 +0000 (14:48 +0100)
committerAkim Demaille <akim@lrde.epita.fr>
Wed, 31 Dec 2014 13:54:43 +0000 (14:54 +0100)
Reported by Bernd Edligner and others.

* src/scan-gram.l: here.

THANKS
src/scan-gram.l

diff --git a/THANKS b/THANKS
index 1b1ff71676a54efb0a84ad087df689627548c5d2..4559a901924a56992aa703daad37fa8632e44842 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -16,6 +16,7 @@ Art Haas                  ahaas@neosoft.com
 Baron Schwartz            baron@sequent.org
 Ben Pfaff                 blp@cs.stanford.edu
 Benoit Perrot             benoit.perrot@epita.fr
+Bernd Edligner            bernd.edlinger@hotmail.de
 Bernd Kiefer              kiefer@dfki.de
 Bert Deknuydt             Bert.Deknuydt@esat.kuleuven.ac.be
 Bill Allombert            Bill.Allombert@math.u-bordeaux1.fr
index abc8a89221059ee85f86f0c268e856fcbfc8606c..d0b81a8becb3b0f35e3e7554ea8bda6988f92a2d 100644 (file)
@@ -45,9 +45,6 @@
 
 #define YY_DECL GRAM_LEX_DECL
 
-#define YY_USER_INIT                                    \
-   code_start = scanner_cursor = loc->start;            \
-
 /* Location of scanner cursor.  */
 static boundary scanner_cursor;
 
@@ -166,6 +163,15 @@ eqopt    ([[:space:]]*=)?
   /* Where containing comment or string or character literal started,
      when applicable.  */
   boundary token_start PACIFY_CC (= scanner_cursor);
+
+  /* We cannot trust YY_USER_INIT, whose semantics changes over time
+     (it moved in Flex 2.5.38).  */
+  static bool first = true;
+  if (first)
+    {
+      scanner_cursor = loc->start;
+      first = false;
+    }
 %}