]> git.saurik.com Git - bison.git/blobdiff - src/scan-gram.l
Generalize the display of semantic values and locations in traces.
[bison.git] / src / scan-gram.l
index 98c5da47e701dff4a78f507ea9433fe3f34aa9e2..3c7d37c484d5932102804351b097cce301058175 100644 (file)
 %option prefix="gram_" outfile="lex.yy.c"
 
 %{
+/* Work around a bug in flex 2.5.31.  See Debian bug 333231
+   <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=333231>.  */
+#undef gram_wrap
+#define gram_wrap() 1
+
 #include "system.h"
 
 #include <mbswidth.h>
@@ -224,6 +229,7 @@ splice       (\\[ \f\t\v]*\n)*
   "%prec"                 rule_length--; return PERCENT_PREC;
   "%printer"              token_type = PERCENT_PRINTER; BEGIN SC_PRE_CODE;
   "%pure"[-_]"parser"     return PERCENT_PURE_PARSER;
+  "%require"              return PERCENT_REQUIRE;
   "%right"                return PERCENT_RIGHT;
   "%skeleton"             return PERCENT_SKELETON;
   "%start"                return PERCENT_START;
@@ -549,7 +555,7 @@ splice       (\\[ \f\t\v]*\n)*
       }
     else
       {
-       complain_at (*loc, _("missing `{' in `%s'"),
+       complain_at (*loc, _("missing `{' in %s"),
                     token_name (token_type));
        obstack_sgrow (&obstack_for_string, "{}");
        STRING_FINISH;
@@ -612,6 +618,15 @@ splice      (\\[ \f\t\v]*\n)*
   "$"("<"{tag}">")?(-?[0-9]+|"$")  handle_dollar (token_type, yytext, *loc);
   "@"(-?[0-9]+|"$")               handle_at (token_type, yytext, *loc);
 
+  "$"  {
+    warn_at (*loc, _("stray `$'"));
+    obstack_sgrow (&obstack_for_string, "$][");
+  }
+  "@"  {
+    warn_at (*loc, _("stray `@'"));
+    obstack_sgrow (&obstack_for_string, "@@");
+  }
+
   <<EOF>>  unexpected_eof (code_start, "}"); BEGIN INITIAL;
 }