Author: avg
Date: Thu Sep 15 10:42:55 2011
New Revision: 225579
URL: http://svn.freebsd.org/changeset/base/225579

Log:
  MFC r209030,209305,209358: In dtrace lexer, do not unput token if it is EOF.
  
  PR:           kern/159064
  On behalf of: kan, marcel

Modified:
  stable/7/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l
Directory Properties:
  stable/7/cddl/contrib/opensolaris/   (props changed)

Modified: stable/7/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l
==============================================================================
--- stable/7/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l     Thu Sep 
15 10:39:44 2011        (r225578)
+++ stable/7/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l     Thu Sep 
15 10:42:55 2011        (r225579)
@@ -45,7 +45,7 @@
 #undef input
 #undef unput
 #else
-/* 
+/*
  * Define YY_INPUT for flex since input() can't be re-defined.
  */
 #define YY_INPUT(buf,result,max_size) \
@@ -60,6 +60,19 @@
                        buf[n] = *yypcb->pcb_strptr++; \
                result = n; \
        }
+/*
+ * Do not EOF let tokens to be put back. This does not work with flex.
+ * On the other hand, leaving current buffer in same state it was when
+ * last EOF was received guarantees that input() will keep returning EOF
+ * for all subsequent invocations, which is the effect desired.
+ */
+#undef  unput
+#define unput(c)                                       \
+       do {                                            \
+               int _c = c;                             \
+               if (_c != EOF)                          \
+                       yyunput(_c, yytext_ptr);        \
+       } while(0)
 #endif
 
 static int id_or_type(const char *);
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to