[antlr-interest] error return code
Terence Parr
parrt at cs.usfca.edu
Mon Jun 18 01:22:36 PDT 2007
On Jun 18, 2007, at 5:59 PM, robermann wrote:
> Hi all,
> a question: let this command (and error):
>
> java Test < myInput.txt
> line 0:-1 mismatched input '<EOF>' expecting '}'
>
> After getting a such parser error, I would expect that either "echo
> %errorlevel%" (on a DOS shell) or "echo $?" (on a Bash shell) would
> return a code not equal to 0. Instead, I get always a return code =
> 0. Is there any particular reason? When automating /scripting, it
> could be useful distinguish whether the parser exit with an
> exception or not.
>
Hi. That's your tool invoking the parser. ANTLR parsers don't exit.
Catch the exception and send out an error code. :)
Ter
More information about the antlr-interest
mailing list