Reported by Cris van Pelt.
* src/lex.c (parse_percent_token): Be sure to set token_buffer.
* tests/regression.at (Invalid input: 1, Invalid input: 2): Merge
into...
(Invalid inputs): Strengthen: exercise parse_percent_token.
+2002-01-24 Akim Demaille <akim@epita.fr>
+
+ Bison dumps core when trying to complain about broken input files.
+ Reported by Cris van Pelt.
+
+ * src/lex.c (parse_percent_token): Be sure to set token_buffer.
+ * tests/regression.at (Invalid input: 1, Invalid input: 2): Merge
+ into...
+ (Invalid inputs): Strengthen: exercise parse_percent_token.
+
2002-01-24 Robert Anisko <robert.anisko@epita.fr>
* src/Makefile.am: Add bison.c++.
Albert Chin-A-Young china@thewrittenword.com
Alexander Belopolsky alexb@rentec.com
Arnold Robbins arnold@skeeve.com
+Cris van Pelt cris@amf03054.office.wxs.nl
Daniel Hagerty hag@gnu.org
David J. MacKenzie djm@gnu.org
Dick Streefland dick.streefland@altium.nl
size_t arg_offset = 0;
int c = getc (finput);
+ obstack_1grow (&token_obstack, '%');
+ obstack_1grow (&token_obstack, c);
switch (c)
{
case '%':
+ token_buffer = obstack_finish (&token_obstack);
return tok_two_percents;
case '{':
+ token_buffer = obstack_finish (&token_obstack);
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 '<':
+ token_buffer = obstack_finish (&token_obstack);
return tok_left;
case '>':
+ token_buffer = obstack_finish (&token_obstack);
return tok_right;
case '2':
+ token_buffer = obstack_finish (&token_obstack);
return tok_nonassoc;
case '0':
+ token_buffer = obstack_finish (&token_obstack);
return tok_token;
case '=':
+ token_buffer = obstack_finish (&token_obstack);
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);
- c = getc (finput);
}
/* %DIRECTIVE="ARG". Separate into
-## ----------------- ##
-## Invalid input 1. ##
-## ----------------- ##
+## ---------------- ##
+## Invalid inputs. ##
+## ---------------- ##
-AT_SETUP([Invalid input: 1])
+AT_SETUP([Invalid inputs])
AT_DATA([input.y],
[[%%
?
-]])
-
-AT_CHECK([bison input.y], [1], [],
-[[input.y:2: invalid input: `?'
-input.y:3: fatal error: no rules in the input grammar
-]])
-
-AT_CLEANUP
-
-
-## ----------------- ##
-## Invalid input 2. ##
-## ----------------- ##
-
-
-AT_SETUP([Invalid input: 2])
-
-AT_DATA([input.y],
-[[%%
default: 'a' }
+%{
+%&
+%a
+%-
]])
AT_CHECK([bison input.y], [1], [],
-[[input.y:2: invalid input: `}'
+[[input.y:2: invalid input: `?'
+input.y:3: invalid input: `}'
+input.y:4: invalid input: `%{'
+input.y:5: invalid input: `%&'
+input.y:6: invalid input: `%a'
+input.y:7: invalid input: `%-'
]])
AT_CLEANUP