d: add push parser support

Support the push-pull directive with the options pull, push and both.
Pull remains the default option.

* data/skeletons/d.m4: Add user aliases for the push parser's return
values: PUSH_MORE, ABORT, ACCEPT.
* data/skeletons/lalr1.d: Add push parser support.
* tests/calc.at: Test it.
This commit is contained in:
Adela Vais
2021-01-29 16:56:13 +02:00
committed by Akim Demaille
parent 4bd4cdf377
commit 9ba3c5ceb9
3 changed files with 204 additions and 54 deletions

View File

@@ -540,7 +540,7 @@ m4_define([AT_CALC_MAIN(d)],
auto l = calcLexer (input);
auto p = new YYParser (l);]AT_DEBUG_IF([[
p.setDebugLevel (1);]])[
return !p.parse ();
return !p.parse();
}
]])
@@ -1510,6 +1510,8 @@ AT_CHECK_CALC_LALR1_D([%locations %define parse.lac full %define parse.error det
AT_CHECK_CALC_LALR1_D([%define api.token.constructor %locations %define parse.error custom %define api.value.type union])
AT_CHECK_CALC_LALR1_D([%define api.token.constructor %locations %define parse.error detailed])
AT_CHECK_CALC_LALR1_D([%define api.push-pull both])
AT_CHECK_CALC_LALR1_D([%define parse.trace %define parse.error custom %locations %define api.push-pull both %define parse.lac full])
# ----------------------- #
# LALR1 Java Calculator. #