Maybe not of interest to you, since you're using antlr 2.7. There is a
similar example of your problem in the ANTLR 3.0 book.
You can solve your problem using a validating predicate:
data: ( c+=CHARACTER)+ {$c.size()<=4}? ;
I know there is no concept of the += in antlr 2.x but maybe you can
adapt the example to work with 2.7 also...
Good luck!
Bill
On Fri, Sep 12, 2008 at 5:48 AM, Olya Krachina <[EMAIL PROTECTED]> wrote:
> Hello,
> I am working on a lexer and i was wondering how i could set a max limit on the
> number of characters that make up a string literal, i.e. it is valid when
> there
> are n (let's say n = 20) or less chars. I tried setting lookahead to 20
> (options
> k = 20) but it did not have any effect. I am using antlr 2.7.
>
> thanks in advance for any ideas on this,
> Olya
>
>
>
> List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address
>
>
List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---