]> git.saurik.com Git - bison.git/blobdiff - src/lex.c
* tests/regression.at, tests/torture.at, tests/calc.at: Adjust to
[bison.git] / src / lex.c
index b0c1ef1813625206d1a47d43d987af8fab6ed6ed..1d2424e2b421c73f6e98f4621996262c8a609af2 100644 (file)
--- a/src/lex.c
+++ b/src/lex.c
@@ -590,43 +590,54 @@ parse_percent_token (void)
   size_t arg_offset = 0;
 
   int c = getc (finput);
   size_t arg_offset = 0;
 
   int c = getc (finput);
+  obstack_1grow (&token_obstack, '%');
+  obstack_1grow (&token_obstack, c);
 
   switch (c)
     {
     case '%':
 
   switch (c)
     {
     case '%':
+      token_buffer = obstack_finish (&token_obstack);
       return tok_two_percents;
 
     case '{':
       return tok_two_percents;
 
     case '{':
+      token_buffer = obstack_finish (&token_obstack);
       return tok_percent_left_curly;
 
       return tok_percent_left_curly;
 
-      /* FIXME: Who the heck are those 5 guys!?! `%<' = `%left'!!!
-        Let's ask for there removal.  */
+      /* The following guys are here for backward compatibility with
+        very ancient Yacc versions.  The paper of Johnson mentions
+        them (as ancient :).  */
     case '<':
     case '<':
+      token_buffer = obstack_finish (&token_obstack);
       return tok_left;
 
     case '>':
       return tok_left;
 
     case '>':
+      token_buffer = obstack_finish (&token_obstack);
       return tok_right;
 
     case '2':
       return tok_right;
 
     case '2':
+      token_buffer = obstack_finish (&token_obstack);
       return tok_nonassoc;
 
     case '0':
       return tok_nonassoc;
 
     case '0':
+      token_buffer = obstack_finish (&token_obstack);
       return tok_token;
 
     case '=':
       return tok_token;
 
     case '=':
+      token_buffer = obstack_finish (&token_obstack);
       return tok_prec;
     }
 
   if (!isalpha (c))
       return tok_prec;
     }
 
   if (!isalpha (c))
-    return tok_illegal;
+    {
+      token_buffer = obstack_finish (&token_obstack);
+      return tok_illegal;
+    }
 
 
-  obstack_1grow (&token_obstack, '%');
-  while (isalpha (c) || c == '_' || c == '-')
+  while (c = getc (finput), isalpha (c) || c == '_' || c == '-')
     {
       if (c == '_')
        c = '-';
       obstack_1grow (&token_obstack, c);
     {
       if (c == '_')
        c = '-';
       obstack_1grow (&token_obstack, c);
-      c = getc (finput);
     }
 
   /* %DIRECTIVE="ARG".  Separate into
     }
 
   /* %DIRECTIVE="ARG".  Separate into