[GoLUG] [parse] Rules ordering
Steve Litt
slitt at troubleshooters.com
Fri Nov 24 19:55:12 EST 2023
Hi all,
In the rules section, the following two megarules determine which
matches prevail:
1) Match the longest possible string every time the scanner matches
input
2) If there's a tie for the longest possible string, use the pattern
that appears first in the rules section.
How Flex implements the preceding rules is a little hard to imagine,
but in most cases it should be pretty clear. However, it's the longest
*string*, not the longest *pattern*, so it's very possible for pattern
"a*" to prevail over pattern "abcdefghijklm".
SteveT
Steve Litt
Autumn 2023 featured book: Rapid Learning for the 21st Century
http://www.troubleshooters.com/rl21
More information about the GoLUG
mailing list