Mikolaj
 
I haven't attempted a grammar yet but below is a textual example:
 
The file should contain three fields called "jobNo", "description" and "cost".
 
The fields should adhere to the following specifications (regex in braces):
jobNo:  must be digits only, maximum 5 - (\d{1,5})
description:  any lowercase characters or space upto a maximum of 128 - ([a-z 
]{1,128})
cost:  positive or negative amount formatted as upto 5 digits before the 
decimal and 4 afterwards zero padded - (-?\d?\d?\d?\d?\d\.\d\d\d\d)
 
E.g.
 
"jobNo","description","cost"
"12345","this record conforms","123.4321"
"987","this RECORD does not conform because of uppercase usage","-22.44"
 
Phil.

--- On Sun, 24/1/10, Mikolaj Koziarkiewicz <[email protected]> 
wrote:


From: Mikolaj Koziarkiewicz <[email protected]>
Subject: Re: [antlr-interest] Quantifiers
To: "Phil Ritchie" <[email protected]>
Cc: [email protected]
Date: Sunday, 24 January, 2010, 12:35


Hi Phil,

could you provide a textual definition of your grammar, and/or your ANTLR 
specification so far?

Cheers,
Nick

> I think ANTLR might be a quick way for me to build a validating lexer/parser. 
> The file I want to validate is essentially a comma separated values file but 
> the content of individual fields must adhere to content and length 
> restrictions. One field specification I can't seem to find a way of declaring 
> is (in regular expression form): [a-zA-Z]{1,128}.
>  Is there a way I could approach this?
>  
> 
>       
> 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

-- 
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.

Reply via email to