mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 20:33:03 +00:00
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:
committed by
Akim Demaille
parent
9ba3c5ceb9
commit
f99314765b
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user