mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
code: be robust to reference with invalid tags
Because we want to support $<a->b>$, we must accept -> in type tags, and reject $<->$, as it is unfinished. Reported by Ahcheong Lee. * src/scan-code.l (yylex): Make sure "tag" does not end with -, since -> does not close the tag. * tests/input.at (Stray $ or @): Check this.
This commit is contained in:
@@ -2548,7 +2548,9 @@ AT_DATA_GRAMMAR([[input.y]],
|
||||
%printer { $%; @%; } <*> exp TOK;
|
||||
%{ $ @ %} // Should not warn.
|
||||
%%
|
||||
exp: TOK { $%; @%; $$ = $1; };
|
||||
exp: TOK { $%; @%; $$ = $1; }
|
||||
| 'a' { $<->1; $$ = 1; }
|
||||
| 'b' { $<foo->bar>$; }
|
||||
%%
|
||||
$ @ // Should not warn.
|
||||
]])
|
||||
@@ -2562,6 +2564,7 @@ input.y:13.19: warning: stray '$' [-Wother]
|
||||
input.y:13.23: warning: stray '@' [-Wother]
|
||||
input.y:16.19: warning: stray '$' [-Wother]
|
||||
input.y:16.23: warning: stray '@' [-Wother]
|
||||
input.y:17.19: warning: stray '$' [-Wother]
|
||||
]])
|
||||
|
||||
AT_BISON_OPTION_POPDEFS
|
||||
|
||||
Reference in New Issue
Block a user