larlr1.cc: Reject unsupported values for parse.lac

Just as the yacc.c skeleton, the lalr1.cc skeleton should reject
invalid values for parse.lac.

* data/skeletons/lalr1.cc: check validity of parse.lac
* tests/input.at: new test cases
This commit is contained in:
Adrian Vogelsgesang
2020-01-19 19:11:23 +01:00
committed by Akim Demaille
parent 6ada985ff3
commit 172f103c1e
2 changed files with 22 additions and 2 deletions

View File

@@ -2367,6 +2367,25 @@ AT_DATA([[input.y]],
start: %empty;
]])
# Only "full" and "none" are accepted for parse.lac
# Unknown values (such as "unsupported") are rejected
AT_BISON_CHECK([[-Dparse.lac=none input.y]])
AT_BISON_CHECK([[-Dparse.lac=none -L c++ input.y]])
AT_BISON_CHECK([[-Dparse.lac=full input.y]])
AT_BISON_CHECK([[-Dparse.lac=full -L c++ input.y]])
AT_BISON_CHECK([[-Dparse.lac=unsupported input.y]],
[[1]], [],
[[<command line>:3: error: invalid value for %define variable 'parse.lac': 'unsupported'
<command line>:3: accepted value: 'full'
<command line>:3: accepted value: 'none'
]])
AT_BISON_CHECK([[-Dparse.lac=unsupported -L c++ input.y]],
[[1]], [],
[[<command line>:3: error: invalid value for %define variable 'parse.lac': 'unsupported'
<command line>:3: accepted value: 'full'
<command line>:3: accepted value: 'none'
]])
# parse.lac.* options are useless if LAC isn't actually activated.
AT_BISON_CHECK([[-Dparse.lac.es-capacity-initial=1 input.y]],
[[1]], [],
@@ -2378,11 +2397,11 @@ AT_BISON_CHECK([[-Dparse.lac.memory-trace=full input.y]],
]])
# parse.lac.* options are useless in C++ even if LAC isn't actually activated.
AT_BISON_CHECK([[-Dparse.lac.es-capacity-initial=1 -L C++ -Dparse.lac input.y]],
AT_BISON_CHECK([[-Dparse.lac.es-capacity-initial=1 -L C++ -Dparse.lac=full input.y]],
[[1]], [],
[[<command line>:3: error: %define variable 'parse.lac.es-capacity-initial' is not used
]])
AT_BISON_CHECK([[-Dparse.lac.memory-trace=full -L C++ -Dparse.lac input.y]],
AT_BISON_CHECK([[-Dparse.lac.memory-trace=full -L C++ -Dparse.lac=full input.y]],
[[1]], [],
[[<command line>:3: error: %define variable 'parse.lac.memory-trace' is not used
]])