> +but rather easier to read. The bare C<*>, C<+> and C<?> quantifiers > +never backtrack in a C<token> unless some outer rule has specified a > +C<:panic> option that applies. If you want to prevent even that, use > +C<*:>, C<+:> or C<?:> to prevent any backtracking into the quantifier. > +If you want to explicitly backtrack, append either a C<?> or a C<+> > +to the quantifier. The C<?> forces minimal matching as usual, > +while the C<+> forces greedy matching. The C<token> declarator is > +really just short for > + > + rule :ratchet { ... } > + > +The other is the C<parse> declarator, for declaring non-terminal > +productions in a grammar. It also does not backtrack unless a > +C<:panic> is in effect or you explicitly specify a backtracking > +quantifier. In addition, a C<parse> rule also assumes C<:words>.
I really don't like the second-to-last sentence above ("It also does not..."). It took me a few reads-through to parse it, and it sounds like it means, "Like c<token>, it does not backtrack unless a C<:panic> is in effect. In addition, it does not backtrack if you explicitly specify a backtracking quantifier." Perhaps you could reword the end of that paragraph as: >>> Like C<token>, it only backtracks when a C<:panic> is in effect or when you explicitly specify a backtracking quantifier. Unlike C<token>, it also assumes C<:words>, making it equivalent to rule :ratchet :words { ... } <<< -- You can't run away forever, but there's nothing wrong with getting a good head start. You want to shut out the night, you want to shut down the sun, you want to shut away the pieces of a broken heart. `Rock and Roll Dreams Come True' (Steinman) http://surreal.istic.org/
signature.asc
Description: Digital signature