>>>>> "SC" == Simon Cozens <[EMAIL PROTECTED]> writes:

  SC> rule comm_eol { <sp*> <comment>? <sp*> \n };
  >> 
  >> aren't those <sp*>'s redundant? the first is overlapping with the one at
  >> the beginning of comment.

  SC> But <comment> only matches if there *is* a comment, and there may not
  SC> be, so I want to match optional space at the EOL anyway.

ok, but since comment is optional, if it doesn't match, the two <sp>*
are back to back. is that needed? i just see too many <sp>* and that
could lead to backtracking issues (something i recall from MRE1).

  SC> rule raiddev { <comment>*
  >> i think that should be comm_eol as you want to skip all full comment lines.

  SC> I thought the .* (or \N*) would skip the whole line. comm_eol just means
  SC> "comment at end of line".
 
i figured that was what it meant. but . matches any char now so .* will
eat all the text until it is forced to backtrack. so \N* will stop at
the newline which is what i think you want in comm_eol.

  >> that is how i understand it. the grammar automatically build a tree of
  >> the grabs with hash keys being the rule names and multiples (rules with
  >> quantifiers) being arrays. 

  SC> Great.

actually i just had another thought. you don't need any of the $foo :=
stuff as the match tree will have it all for you. unless you need a
single var having some grabbed stuff, you might as well let the match
object hold it all. you do want a tree from this parser so the single
vars will do no good. unless they also put stuff into the tree based on
their names. also if you use a scalar to grab something which is in a
quantified outer rule what is put in the var? a ref to a list of the
grabbed things?

uri

-- 
Uri Guttman  ------  [EMAIL PROTECTED]  -------- http://www.stemsystems.com
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org

Reply via email to