[antlr-interest] Please help with grammar tweak

Jim Idle jimi at temporal-wave.com
Mon Nov 30 14:13:08 PST 2009


Change:

(COMMA! array_data)?

To:

(COMMA! array_data)*

Jim

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Brian Krahmer
> Sent: Monday, November 30, 2009 2:05 PM
> To: antlr-interest at antlr.org
> Subject: [antlr-interest] Please help with grammar tweak
> 
> Hello,
>   I have a small issue with a grammar file, and really don't know what
> I'm doing.  :)  Can anyone help me please?
> 
> Applicable part of my grammar:
> 
> const_array : lb:LBRACK list_array_data RBRACK! ;
> list_array_data : array_data (COMMA! array_data)? ;
> array_data  : atom  |  (STRING1 | STRING2) ARROW^ atom ;
> 
> "foo = [1, 2];" works.  However, I need to be able to have 1..n
> array_data elements, such as "foo = [1, 2, 3, 4];"
> 
> I'm sure this is probably a small tweak, but I'm not sure how to fix
> it.  Thanks in advance!
> 
> 
> 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