John Macdonald:

> [trans]
> If a shorter rule is allowed to match first, then the longer
> rule can be removed from the match set, at least for constant
> string matches.

It is not about the length of the rules, but about the length of the
matches.

If both \s+ and \h+ match the same length, should then \h+ be honored
because it is more specific?

And are we only talking about matches at the same position? (Stepping
through the input-buffer character-by-character, and testing each
pattern.)


> If, for example, '=' can match without
> preferring to try first for '==' then you'll never match '=='
> without syntactic help to force a backtracking retry.

If rules will match in order of appearance, it is to the user to put the
rules in the right order.

Some help can be provided, like a warning when an 'ab' precedes an
'abc', and maybe even when an 'a*' precedes an 'a+'.

-- 
Grtz, Ruud

Reply via email to