On Sat, Aug 30, 2003 at 08:34:11AM -0700, Randal L. Schwartz wrote: > >>>>> "Colin" == Colin Kuskie <[EMAIL PROTECTED]> writes: > > Colin> I often find myself giving identical productions different > Colin> identifiers to make my grammar clearer and to get around the limitation > Colin> of named access only giving the last match to an identifier, like > Colin> the following: > > What I've done is define the details once, then just had a simple > rule that renamed it: > > cell: cell_or_inst > inst: cell_or_inst > cell_or_inst: /\w+/
That's a good work-around. Thanks! > Oh, and leave off the { $item[1] } for those. That's the default. :) I know, but you have to know that most of the crew that I work with would learn a lot from reading PORM. I try to write the more complex stuff as clearly as I can so that they can follow it (and I don't forget it later as well!). That's why I suggested the syntax. To me, it seems more clear. It's very analogous to what I think Perl6 would allow: $cell = $inst = m:/\w+/; Maybe I'll try hacking P::RD and see if I can make a patch and supporting tests. It shouldn't be too hard, since I don't want to change the tokenizer, only the lexer. But it's going to break the current behavior where that particular syntax creates an empty pattern that always matches. Colin