mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-22 18:53:04 +00:00
java: example: improve
* examples/java/Calc.y: Propagate the exit status. Support -p.
This commit is contained in:
@@ -4,6 +4,8 @@
|
|||||||
%define api.parser.public
|
%define api.parser.public
|
||||||
|
|
||||||
%define parse.error verbose
|
%define parse.error verbose
|
||||||
|
%define parse.trace
|
||||||
|
|
||||||
%locations
|
%locations
|
||||||
|
|
||||||
%code imports {
|
%code imports {
|
||||||
@@ -19,7 +21,11 @@
|
|||||||
{
|
{
|
||||||
CalcLexer l = new CalcLexer (System.in);
|
CalcLexer l = new CalcLexer (System.in);
|
||||||
Calc p = new Calc (l);
|
Calc p = new Calc (l);
|
||||||
p.parse ();
|
for (String arg : args)
|
||||||
|
if (arg.equals ("-p"))
|
||||||
|
p.setDebugLevel (1);
|
||||||
|
if (!p.parse ())
|
||||||
|
System.exit (1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user