[antlr-interest] Please help with arbitrary arrangements and old
BNF syntax
Matt Benson
gudnabrsam at yahoo.com
Fri Dec 16 12:41:13 PST 2005
oh, actually, I guess that'd have to be:
test
: ( foo (bar (baz)? | baz (bar)?)?
| bar (foo (baz)? | baz (foo)?)?
| baz (foo (bar)? | bar (foo)?)?
)?
;
Definitely wouldn't want to take this much past
three... ;)
-Matt
--- Matt Benson <gudnabrsam at yahoo.com> wrote:
> 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
>
__________________________________________________
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