summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAdela Vais <adela.vais99@gmail.com>2021-03-27 17:23:31 +0200
committerAkim Demaille <akim.demaille@gmail.com>2021-04-11 07:41:39 +0200
commitf99314765bec4c79c96c36fb733862db25b237b5 (patch)
tree083e981897c88e35a8e54a8264d74085c73a3988 /examples
parent9ba3c5ceb9ca51056bb254925bc6708261a3db1c (diff)
downloadbison-f99314765bec4c79c96c36fb733862db25b237b5.tar.gz
d: demonstrate the push parser
* examples/d/calc/calc.y: Use a parser of type 'push' in the calc example.
Diffstat (limited to 'examples')
-rw-r--r--examples/d/calc/calc.y6
1 files changed, 5 insertions, 1 deletions
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;
}