[antlr-interest] Please help with arbitrary arrangements and old
BNF syntax
Matt Benson
gudnabrsam at yahoo.com
Fri Dec 16 12:33:55 PST 2005
Also, when you have a set as small as three, you could
use this non-scaling approach:
test
: ( foo (bar (baz)? | baz)?
| bar (foo (baz)? | baz)?
| baz (foo (bar)? | bar)?
)?
;
FWIW,
Matt
--- Brannon King <BBKing at starbridgesystems.com> wrote:
> Suppose I have the following parser rule snipped
> from edif.org:
>
> written :
> LP! "written"
> timeStamp
> ( < author > | < program > | < dataOrigin > |
> property | comment | userData )*
> RP!;
>
> Where the angle brackets mean that those can only
> appear once (in an
> arbitrary order). How do I enforce this in an ANTLR
> grammar?
>
> In a similar vein, is this the right way to limit an
> identifier length?
>
> IDENTIFIER
> options {testLiterals=true;} //make sure it's not a
> built in
> function
> : (ALPHA|'&') a:('_'|ALPHA|DIGIT)*
> {a.getText().length() < 256}? ; //less than 256
> chars total
>
> Thanks for your time
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the antlr-interest
mailing list