mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-10 12:53:03 +00:00
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.
This commit is contained in:
10
ChangeLog
10
ChangeLog
@@ -1,3 +1,13 @@
|
||||
2002-01-22 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-21 Paolo Bonzini <bonzini@gnu.org>
|
||||
|
||||
* po/it.po: New.
|
||||
|
||||
3
NEWS
3
NEWS
@@ -3,11 +3,12 @@ Bison News
|
||||
|
||||
Changes in version 1.31a:
|
||||
|
||||
* Fix YACC option output file names
|
||||
* Fix Yacc output file names
|
||||
|
||||
* Portability fixes
|
||||
|
||||
* Italian translation
|
||||
|
||||
|
||||
Changes in version 1.31, 2002-01-14:
|
||||
|
||||
|
||||
1
THANKS
1
THANKS
@@ -6,6 +6,7 @@ Akim Demaille akim@freefriends.org
|
||||
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
|
||||
|
||||
23
src/lex.c
23
src/lex.c
@@ -590,43 +590,54 @@ parse_percent_token (void)
|
||||
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
|
||||
|
||||
@@ -545,40 +545,30 @@ AT_CHECK([fgrep '//*' union-comment.tab.c], [1], [])
|
||||
AT_CLEANUP
|
||||
|
||||
|
||||
## ----------------- ##
|
||||
## Invalid input 1. ##
|
||||
## ----------------- ##
|
||||
## ---------------- ##
|
||||
## Invalid inputs. ##
|
||||
## ---------------- ##
|
||||
|
||||
|
||||
AT_SETUP([Invalid input: 1])
|
||||
AT_SETUP([Invalid inputs])
|
||||
|
||||
AT_DATA([input.y],
|
||||
[[%%
|
||||
?
|
||||
default: 'a' }
|
||||
%{
|
||||
%&
|
||||
%a
|
||||
%-
|
||||
]])
|
||||
|
||||
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' }
|
||||
]])
|
||||
|
||||
AT_CHECK([bison input.y], [1], [],
|
||||
[[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
|
||||
|
||||
Reference in New Issue
Block a user