[antlr-interest] Lexer Rule matching member variable (Java)
Frederic Beister
azamir at azamir.de
Sun Aug 22 06:22:14 PDT 2010
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
just for the archives: This worked with small one small modification
regarding the EOF-Token:
TEXT:
{lxstate == State.NORMAL && input.LA(1) != curspecial}?=>.
{
while (input.LA(1) != curspecial && input.LA(1) != CharStream.EOF) {
input.consume();
}
}
;
Thanks again
Frederic
Am 20.08.2010 18:15, schrieb Jim Idle:
> You just need to not use ANY. Once the predicate matches, your rule is
> selected and it will do whatever you tell it. So, don't use ANY+ just put
> some code in to consume until you get to some point that you don't want to
> consume any more:
>
> TEXT: { lxstate==State.NORMAL && input.LA(1)!=curspecial} ?=> .
> {
> while (input.LA(1) != curspecial) { input.consume(); }
> }
> ;
>
> It is often instructive to look at the generated code and steal from it to
> get where you need to.
>
> Jim
>
>> -----Original Message-----
>> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
>> bounces at antlr.org] On Behalf Of Frederic Beister
>> Sent: Friday, August 20, 2010 12:34 AM
>> To: antlr-interest at antlr.org
>> Subject: Re: [antlr-interest] Lexer Rule matching member variable (Java)
>>
>>
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
email-address
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
- --
PGP Fingerprint = 782C 2BE7 0972 D632 8BDF 4A23 3811 174A 1530 64ED
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkxxJIIACgkQOBEXShUwZO10xQCfZtRkA0b9yyfQJze4IsogkdaK
5xMAnjnIEqtmMPhGsNRKUSvyXotxf0rz
=bq0d
-----END PGP SIGNATURE-----
More information about the antlr-interest
mailing list