mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-11 21:33:04 +00:00
Allow %start after the first rule.
* src/reader.c (grammar_current_rule_begin): Don't set the start symbol when parsing the first rule. (check_and_convert_grammar): Search for it here after all grammar declarations have been parsed. Skip midrules, which have dummy LHS nonterminals. * src/symtab.c (symbol_is_dummy): New function. * src/symtab.h (symbol_is_dummy): Declare it. * tests/input.at (%start after first rule): New test.
This commit is contained in:
@@ -537,3 +537,24 @@ input.y:20.1: syntax error, unexpected end of file, expecting ;
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
|
||||
## ------------------------- ##
|
||||
## %start after first rule. ##
|
||||
## ------------------------- ##
|
||||
|
||||
AT_SETUP([%start after first rule])
|
||||
|
||||
# Bison once complained that a %start after the first rule was a redeclaration
|
||||
# of the start symbol.
|
||||
|
||||
AT_DATA([input.y],
|
||||
[[%%
|
||||
false_start: ;
|
||||
start: false_start ;
|
||||
%start start;
|
||||
]])
|
||||
|
||||
AT_CHECK([bison -o input.c input.y])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
Reference in New Issue
Block a user