On Friday, Aug 29, 2003 Colin Kuskie said: I know its real simple, but below is what I have done in a similar situation:
> I often find myself giving identical productions different > identifiers to make my grammar clearer and to get around the limitation > of named access only giving the last match to an identifier, like > the following: > > my $grammar = <<'EOGRAMMAR'; > > instance : cell inst '(' signal(s /,/) ')' ';' > > { bless { cell => $item{cell}, > inst => $item{inst}, > signals => $item[4] > }, $item[0]; } > > > cell : /\w+/ > > { $item [1] } > > inst : /\w+/ > > { $item [1] } > > signal: '.' dest '(' src ')' > > { > bless { dest => $item{dest}, > src => $item{src} > }, $item[0]; > } > > src : /[^)(]+/ > > { $item [1] } > > dest : /[^)(]+/ > > { $item [1] } > > EOGRAMMAR > > I was wondering if there was a way to specify multiple identifiers > with the same production with a syntax like: > > cell item : /\w+/ > > or > > cell, item : /\w+/ > > or > > cell: > item: /w+/ cell_or_item: /\w+/ > > Thanks, > Colin Kuskie -- Intel, Corp. 5000 W. Chandler Blvd. Chandler, AZ 85226 -- Intel, Corp. 5000 W. Chandler Blvd. Chandler, AZ 85226