]> git.saurik.com Git - bison.git/commitdiff
* src/scan-gram.l: When it starts with `%', complain about the
authorAkim Demaille <akim@epita.fr>
Tue, 5 Nov 2002 21:20:14 +0000 (21:20 +0000)
committerAkim Demaille <akim@epita.fr>
Tue, 5 Nov 2002 21:20:14 +0000 (21:20 +0000)
whole directive, not just that `invalid character: %'.

ChangeLog
src/scan-gram.l

index 18a56470ccb5ab2da11644fb7505be838f370c21..30b3d102a0d002ca079ce3793275d52326f11b72 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2002-11-05  Akim Demaille  <akim@epita.fr>
+
+       * src/scan-gram.l: When it starts with `%', complain about the
+       whole directive, not just that `invalid character: %'.
+
 2002-11-04  Akim Demaille  <akim@epita.fr>
 
        * Makefile.maint: Update from Autoconf.
index 4475ed27b6fa8140c86dcb3e9f51475d4cc65b87..e86206467765fc7f2c171788bcf9e1fa6354ec69 100644 (file)
@@ -186,9 +186,10 @@ static int convert_ucn_to_byte (char const *hex_text);
 %x SC_ESCAPED_STRING SC_ESCAPED_CHARACTER
 %x SC_BRACED_CODE SC_PROLOGUE SC_EPILOGUE
 
-letter  [.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_]
-id      {letter}({letter}|[0-9])*
-int     [0-9]+
+letter   [.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_]
+id       {letter}({letter}|[0-9])*
+directive %{letter}({letter}|[0-9]|-)*
+int      [0-9]+
 
 /* POSIX says that a tag must be both an id and a C union member, but
    historically almost any character is allowed in a tag.  We disallow
@@ -247,6 +248,11 @@ splice      (\\[ \f\t\v]*\n)*
   "%verbose"              return PERCENT_VERBOSE;
   "%yacc"                 return PERCENT_YACC;
 
+  {directive}             {
+    complain_at (*yylloc, _("invalid directive: %s"), quote (yytext));
+    YY_STEP;
+  }
+
   "="                     return EQUAL;
   ":"                     rule_length = 0; return COLON;
   "|"                     rule_length = 0; return PIPE;