diff options
author | Akim Demaille <akim.demaille@gmail.com> | 2019-05-03 09:19:21 +0200 |
---|---|---|
committer | Akim Demaille <akim.demaille@gmail.com> | 2019-05-03 16:28:28 +0200 |
commit | 8c06cb9130a8d80d252f3e16a9d3a166a5139811 (patch) | |
tree | ee22f578eeda5f6a0a23c8b5032f52fa3f9951f2 /tests | |
parent | b5233ba323aa5eed354c3d581a9629647ac4aebb (diff) | |
download | bison-8c06cb9130a8d80d252f3e16a9d3a166a5139811.tar.gz |
fixits: be sure to preserve the action when adding %empty
Currently we remove the rhs to install %empty instead.
* src/reader.c (grammar_rule_check_and_complete): Insert the missing
%empty in front of the rhs, not in replacement thereof.
* tests/actions.at (Add missing %empty): Check that.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/actions.at | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/actions.at b/tests/actions.at index 691c84ec..1f279a89 100644 --- a/tests/actions.at +++ b/tests/actions.at @@ -259,6 +259,46 @@ AT_BISON_OPTION_POPDEFS AT_CLEANUP + +## -------------------- ## +## Add missing %empty. ## +## -------------------- ## + +AT_SETUP([Add missing %empty]) + +AT_DATA([input.y], +[[%% +exp: a b c d e +a: {} +b:{ +}; +c: +d +: +e: +%% +]]) + +AT_BISON_CHECK([--update -Wall input.y], [], [], [ignore]) +AT_CHECK([cat input.y], [], +[[%% +exp: a b c d e +a: %empty {} +b: %empty { +}; +c: %empty @&t@ +d +: %empty @&t@ +e: %empty @&t@ +%% +]]) + +# No warnings. +AT_BISON_CHECK([-Wall input.y]) + +AT_CLEANUP + + ## ------------------ ## ## Initial location. ## ## ------------------ ## |