From f99314765bec4c79c96c36fb733862db25b237b5 Mon Sep 17 00:00:00 2001 From: Adela Vais Date: Sat, 27 Mar 2021 17:23:31 +0200 Subject: [PATCH] d: demonstrate the push parser * examples/d/calc/calc.y: Use a parser of type 'push' in the calc example. --- examples/d/calc/calc.y | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/d/calc/calc.y b/examples/d/calc/calc.y index 8b885a57..6e062a69 100644 --- a/examples/d/calc/calc.y +++ b/examples/d/calc/calc.y @@ -22,6 +22,7 @@ %define api.parser.class {Calc} %define parse.error detailed %define parse.trace +%define api.push-pull push %locations @@ -181,6 +182,9 @@ int main() import core.stdc.stdlib : getenv; if (getenv("YYDEBUG")) p.setDebugLevel(1); - p.parse(); + int status; + do { + status = p.pushParse(l.yylex()); + } while (status == PUSH_MORE); return l.exit_status; }