mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-20 09:43:03 +00:00
* tests/regression.at (Invalid input): New.
* src/lex.c (lex): Be sure to set `token_buffer' in any case. Reported by Shura.
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
2001-10-02 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
|
* tests/regression.at (Invalid input): New.
|
||||||
|
* src/lex.c (lex): Be sure to set `token_buffer' in any case.
|
||||||
|
Reported by Shura.
|
||||||
|
|
||||||
2001-10-02 Akim Demaille <akim@epita.fr>
|
2001-10-02 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
* tests/calc.at: Now that --debug works, the tests must be adjusted.
|
* tests/calc.at: Now that --debug works, the tests must be adjusted.
|
||||||
|
|||||||
13
src/lex.c
13
src/lex.c
@@ -469,32 +469,40 @@ lex (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
case ',':
|
case ',':
|
||||||
|
token_buffer = ",";
|
||||||
return tok_comma;
|
return tok_comma;
|
||||||
|
|
||||||
case ':':
|
case ':':
|
||||||
|
token_buffer = ":";
|
||||||
return tok_colon;
|
return tok_colon;
|
||||||
|
|
||||||
case ';':
|
case ';':
|
||||||
|
token_buffer = ";";
|
||||||
return tok_semicolon;
|
return tok_semicolon;
|
||||||
|
|
||||||
case '|':
|
case '|':
|
||||||
|
token_buffer = "|";
|
||||||
return tok_bar;
|
return tok_bar;
|
||||||
|
|
||||||
case '{':
|
case '{':
|
||||||
|
token_buffer = "{";
|
||||||
return tok_left_curly;
|
return tok_left_curly;
|
||||||
|
|
||||||
case '=':
|
case '=':
|
||||||
|
obstack_1grow (&token_obstack, c);
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
c = getc (finput);
|
c = getc (finput);
|
||||||
|
obstack_1grow (&token_obstack, c);
|
||||||
if (c == '\n')
|
if (c == '\n')
|
||||||
lineno++;
|
lineno++;
|
||||||
}
|
}
|
||||||
while (c == ' ' || c == '\n' || c == '\t');
|
while (c == ' ' || c == '\n' || c == '\t');
|
||||||
|
obstack_1grow (&token_obstack, '\0');
|
||||||
|
token_buffer = obstack_finish (&token_obstack);
|
||||||
|
|
||||||
if (c == '{')
|
if (c == '{')
|
||||||
{
|
{
|
||||||
token_buffer = "={";
|
|
||||||
return tok_left_curly;
|
return tok_left_curly;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -511,6 +519,9 @@ lex (void)
|
|||||||
return parse_percent_token ();
|
return parse_percent_token ();
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
obstack_1grow (&token_obstack, c);
|
||||||
|
obstack_1grow (&token_obstack, '\0');
|
||||||
|
token_buffer = obstack_finish (&token_obstack);
|
||||||
return tok_illegal;
|
return tok_illegal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ AT_CLEANUP([union.*])
|
|||||||
AT_SETUP([%union and C comments])
|
AT_SETUP([%union and C comments])
|
||||||
|
|
||||||
AT_DATA([union-comment.y],
|
AT_DATA([union-comment.y],
|
||||||
[%union
|
[%union
|
||||||
{
|
{
|
||||||
/* The int. */ int integer;
|
/* The int. */ int integer;
|
||||||
/* The string. */ char *string ;
|
/* The string. */ char *string ;
|
||||||
@@ -87,3 +87,23 @@ AT_CHECK([bison union-comment.y])
|
|||||||
AT_CHECK([fgrep '//*' union-comment.tab.c], [1], [])
|
AT_CHECK([fgrep '//*' union-comment.tab.c], [1], [])
|
||||||
|
|
||||||
AT_CLEANUP([union-comment.*])
|
AT_CLEANUP([union-comment.*])
|
||||||
|
|
||||||
|
|
||||||
|
## --------------- ##
|
||||||
|
## invalid input. ##
|
||||||
|
## --------------- ##
|
||||||
|
|
||||||
|
|
||||||
|
AT_SETUP([Invalid input])
|
||||||
|
|
||||||
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user