Well, since 32 isn't that big you can use brute force. Below is an example
that gives you identifiers that are no longer than 32 characters need to
start with a letter and then can have letters, numbers, or underscores.
grammar Example;
ID : AL
ALN? ALN? ALN? ALN? ALN?
ALN? ALN? ALN? ALN? ALN?
ALN? ALN? ALN? ALN? ALN?
ALN? ALN? ALN? ALN? ALN?
ALN? ALN? ALN? ALN? ALN?
ALN? ALN? ALN? ALN? ALN?
ALN?
;
AL : 'a'..'z' | 'A'..'Z';
ALN : AL | '_' | '0'..'9';
Hope this helps,
Tim
On Tue, Sep 23, 2008 at 11:30 AM, waqas javed <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I am writing a parser in antlr. Can you tell me how I can limit the
> number
> of characters in string. Actually I want to limit the max number of
> characters
> for an identifier to 32.
>
> I am using the comman ('a'..'z')+ but this dont put any restriction on
> the
> max number of characters that can be there in an identifier.
>
> regards,
>
> waqas
>
>
> 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
-~----------~----~----~----~------~----~------~--~---
List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address