[antlr-interest] Please help with arbitrary arrangements and
oldBNF syntax
Geir Ove Skjaervik
geiroves at online.no
Fri Dec 16 12:39:45 PST 2005
Hello,
Neat ! Surely more elegant than my solution :-)
Geir Ove
-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Matt Benson
Sent: 16. desember 2005 21:34
To: Brannon King; antlr-interest at antlr.org
Subject: Re: [antlr-interest] Please help with arbitrary arrangements
and oldBNF syntax
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