Skip to content

Commit f993147

Browse files
adelavaisakimd
authored andcommitted
d: demonstrate the push parser
* examples/d/calc/calc.y: Use a parser of type 'push' in the calc example.
1 parent 9ba3c5c commit f993147

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

examples/d/calc/calc.y

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
%define api.parser.class {Calc}
2323
%define parse.error detailed
2424
%define parse.trace
25+
%define api.push-pull push
2526

2627
%locations
2728

@@ -181,6 +182,9 @@ int main()
181182
import core.stdc.stdlib : getenv;
182183
if (getenv("YYDEBUG"))
183184
p.setDebugLevel(1);
184-
p.parse();
185+
int status;
186+
do {
187+
status = p.pushParse(l.yylex());
188+
} while (status == PUSH_MORE);
185189
return l.exit_status;
186190
}

0 commit comments

Comments
 (0)