mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-11 05:13:04 +00:00
In Bison 1.875's yacc.c, YYLLOC_DEFAULT was called regardless
whether the reducion was empty or not. This leaves room to improve the use of YYLLOC_DEFAULT in such a case. lalr1.cc is still experimental, so changing this is acceptable. And finally, there are probably not many users who changed the handling of locations in GLR, so changing is admissible too. * data/glr.c, data/lalr1.cc, data/yacc.c (YYLLOC_DEFAULT): On an empty reduction, set @$ to an empty location ending the previously stacked symbol. Adjust uses to make sure the code is triggered on empty reductions. * tests/actions.at (_AT_CHECK_PRINTER_AND_DESTRUCTOR): Adjust the expected output: empty reductions have empty locations.
This commit is contained in:
@@ -372,8 +372,8 @@ thing (1@10-19): 'x' (1@10-19)
|
||||
sending: ')' (2@20-29)
|
||||
line (0@0-29): '(' (0@0-9) thing (1@10-19) ')' (2@20-29)
|
||||
sending: EOF (3@30-39)
|
||||
input (0@0-29): /* Nothing */
|
||||
input (2@0-29): line (0@0-29) input (0@0-29)
|
||||
input (0@29-29): /* Nothing */
|
||||
input (2@0-29): line (0@0-29) input (0@29-29)
|
||||
Successful parse.
|
||||
]])
|
||||
|
||||
@@ -390,8 +390,8 @@ Freeing token 'y' (1@10-19)
|
||||
sending: ')' (2@20-29)
|
||||
line (-1@0-29): '(' (0@0-9) error (@10-19) ')' (2@20-29)
|
||||
sending: EOF (3@30-39)
|
||||
input (0@0-29): /* Nothing */
|
||||
input (2@0-29): line (-1@0-29) input (0@0-29)
|
||||
input (0@29-29): /* Nothing */
|
||||
input (2@0-29): line (-1@0-29) input (0@29-29)
|
||||
Successful parse.
|
||||
]])
|
||||
|
||||
@@ -438,8 +438,8 @@ thing (11@110-119): 'x' (11@110-119)
|
||||
sending: ')' (12@120-129)
|
||||
line (10@100-129): '(' (10@100-109) thing (11@110-119) ')' (12@120-129)
|
||||
sending: 'y' (13@130-139)
|
||||
input (0@100-129): /* Nothing */
|
||||
input (2@100-129): line (10@100-129) input (0@100-129)
|
||||
input (0@129-129): /* Nothing */
|
||||
input (2@100-129): line (10@100-129) input (0@129-129)
|
||||
input (2@70-129): line (7@70-99) input (2@100-129)
|
||||
input (2@0-129): line (-1@0-69) input (2@70-129)
|
||||
130-139: syntax error, unexpected 'y', expecting $end
|
||||
|
||||
Reference in New Issue
Block a user