> Hi!
>
> I cant figure out why this grammar dont work (I have left out some
> not relevant stuff).
> This expression works:[ LOOKUP( A1234567890, 9TN ) ] 93
> This dont:[ LOOKUP( A1234567890, ATN ) ] 93
> Why?
>
>
>
> prog returns [NationalDutyExprHelper value] :
> item (i
ptions I think. Look at
> the nextToken() method. It should be the thing that handles errors
> emitted from calling mTokens() rule method.
>
> Ter
> On Jan 17, 2009, at 4:17 PM, Mats Ekberg wrote:
>
>> Hi!
>>
>> To generate a custom catch clause in
Hi!
To generate a custom catch clause in the parser one can write:
@rulecatch {
..code..
}
How do I accomplish the same thing in the lexer?
/mats
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"il-antlr-inter
: antlr-interest-boun...@antlr.org
> [mailto:antlr-interest-boun...@antlr.org
> ] On Behalf Of Jim Idle
> Sent: Wednesday, January 07, 2009 11:31 AM
> Cc: antlr-inter...@antlr.org
> Subject: Re: [antlr-interest] expression parser example Expr.g dont
> work
>
>
>
> Mats
>
> The current form hits the ‘(‘ and then looks for expr which requires a
> NEWLINE after ‘2’ which you don’t have.
>
>
>
> I didn’t verify this though.
>
>
>
> C
>
>
>
>
>
> __
>
> From:antlr-interest-boun...@antlr.org
> [mailto:antlr-int
I have stripped the classical expr.g example and when I run it in
ANTLRWorks it dont work.
The input "(1 + 2) * 3 - 4" (with a newline at the end) just recognizes
"( 1 + 2" and the nothing more.
How come?
grammar Expr;
prog: stat+ ;
stat: expr NEWLINE
| NEWLINE
;
expr
: mul
its a measurement.
ok?
regards
mats
mån 2008-12-29 klockan 08:10 -0600 skrev Gary R. Van Sickle:
> > From: Mats Ekberg
> >
> > Lets say a three letter word in uppercase can mean one of two
> > tings like:
> >
> > 10 EUR
> > where EUR means
Lets say a three letter word in uppercase can mean one of two tings
like:
10 EUR
where EUR means a monetary unit
10 EUR / TNE
where EUR still means a monetary unit but the three letters TNE now
means a measurement uniot.
How can that be expressed in a grammar??
/mats
--~--~-~--~
I want to have one action being executed if no patterns match, like:
stat:
'SWAP' { fh.swap();}
| 'DROP' { fh.drop();}
| { fh.print(text);}
on SWAP fh.swap() gets executed.
on DROP fh.drop()
and if no match i want fh.print() be called with the text that did not match
any