[antlr-interest] How to parse Several Option in one group in dífferent order

Martin Kortmann email at kortmann.de
Wed Aug 1 01:57:42 PDT 2007


Hi,

I have to parse a textfile which is divided in several
groups. Inside of this groups where several options.
This option can occur in any order, but only zero or
one times. I have this construction:

header:	BEG 'HEADER'
           ( project_no version
           | version project_no
           | version
           | project_no
           |
           )
         END 'HEADER'
       ;

This is OK for only two options, but i have also
sections with mor than ten options.

How can i made this rule easier? Does i have to track
this by hand?

Martin


More information about the antlr-interest mailing list