[antlr-interest] Quantifiers
Phil Ritchie
endigitalmind at yahoo.co.uk
Sun Jan 24 12:29:20 PST 2010
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 <e0309169 at student.tuwien.ac.at> wrote:
From: Mikolaj Koziarkiewicz <e0309169 at student.tuwien.ac.at>
Subject: Re: [antlr-interest] Quantifiers
To: "Phil Ritchie" <endigitalmind at yahoo.co.uk>
Cc: antlr-interest at antlr.org
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
>
More information about the antlr-interest
mailing list