[antlr-interest] parser not throwing exception
Martin Probst
mail at martin-probst.com
Sun Aug 13 06:45:42 PDT 2006
Like this:
MyParser extends Parser;
options {
defaultErrorHandler = false;
}
HTH,
Martin
Am 13.08.2006 um 11:25 schrieb Dilip Easwaran:
> Hi All:
>
> I am using antlr version 2.7.5.
> I have for my requirements a calculation utility as part of
> which i have defined a function "len": Basically, returns the
> length of an alphanumeric input
>
> len returns [ String result = "" ] throws Exception :
> LENKEYWORD
> (
> LPAREN
> (
> result = statement
> )
> RPAREN
> (
> { result = ""+result.length(); }
> )
> );
>
>
> for Iput : len("Hello!"
>
> the result is : line 1:10: expecting RPAREN, found 'null' .
>
> But it is logging this error to the stderr and not throwing
> it. I cant override reportError method in LLkParser to throw an
> exception.
> how do i go about doing this?
>
> Regards,
>
> Dilip
>
>
>
>
>
More information about the antlr-interest
mailing list