d: demonstrate the push parser

* examples/d/calc/calc.y: Use a parser of type 'push' in the calc
example.
This commit is contained in:
Adela Vais
2021-03-27 17:23:31 +02:00
committed by Akim Demaille
parent 9ba3c5ceb9
commit f99314765b

View File

@@ -22,6 +22,7 @@
%define api.parser.class {Calc} %define api.parser.class {Calc}
%define parse.error detailed %define parse.error detailed
%define parse.trace %define parse.trace
%define api.push-pull push
%locations %locations
@@ -181,6 +182,9 @@ int main()
import core.stdc.stdlib : getenv; import core.stdc.stdlib : getenv;
if (getenv("YYDEBUG")) if (getenv("YYDEBUG"))
p.setDebugLevel(1); p.setDebugLevel(1);
p.parse(); int status;
do {
status = p.pushParse(l.yylex());
} while (status == PUSH_MORE);
return l.exit_status; return l.exit_status;
} }