On Thu, 25 Jul 2002, [EMAIL PROTECTED] wrote: > Why is the skip token attached to a rule? I have my grammar written > such that a lot of different rules can borrow from the same atomic > subrules. Take for instance, a color definition. It could be used > as a field in a person's favorite color, or in the DuPont catalog. > If I used the skip directive, I would have to put it in every > concievable entry point in the grammar, and I really don't know > where someone is going to enter the grammar. So I would be forced > to do it this way: > > my $contrived_grammar = q{ > dupont_catalog: <skip: qr/,?/> > color > ... > > personal_favorites: <skip: qr/,?/> > color > ... > > color: <skip: qr/,?/> > RGB > | some_other_way_of_defining_color > }
OK, I suggested <skip> with the caveat that a full example was needed for me (and others) to help you. You still haven't done that, so it's hard to keep guessing what you're looking for. To answer your question, you could have a top-level rule, e.g. 'input': input: <skip: qr/,?/> personal_favorites | dupont_catalog I believe the doc says that the <skip> setting gets inherited by subrules, so specifying <skip: qr/,?/> for 'color', when 'color' is used by 'input', is redundant. Here's the relevant portion of the doc: The "<skip>" directive enables the terminal prefix used in a production to be changed. For example: OneLiner: Command <skip:'[ \t]*'> Arg(s) /;/ causes only blanks and tabs to be skipped before terminals in the "Arg" subrule (and any of its subrules>, and also before the final "/;/" terminal. Ted