ANYOFPOSIXL ANYOF, sv charclass_posixl S ; Like ANYOFL, but matches [[:posix:]] classes
# Must be sequential
-ANYOFH ANYOF, sv 1 S ; Like ANYOF, but only has "High" matches, none in the bitmap; the flags field contains the lowest matchable UTF-8 start byte
-ANYOFHb ANYOF, sv 1 S ; Like ANYOFH, but all matches share the same UTF-8 start byte, given in the flags field
-ANYOFHr ANYOF, sv 1 S ; Like ANYOFH, but the flags field contains packed bounds for all matchable UTF-8 start bytes.
-ANYOFHs ANYOF, sv 1 S ; Like ANYOFHb, but has a string field that gives the leading matchable UTF-8 bytes; flags field is len
+ANYOFH ANYOFH, sv 1 S ; Like ANYOF, but only has "High" matches, none in the bitmap; the flags field contains the lowest matchable UTF-8 start byte
+ANYOFHb ANYOFH, sv 1 S ; Like ANYOFH, but all matches share the same UTF-8 start byte, given in the flags field
+ANYOFHr ANYOFH, sv 1 S ; Like ANYOFH, but the flags field contains packed bounds for all matchable UTF-8 start bytes.
+ANYOFHs ANYOFH, sv:str 1 S ; Like ANYOFHb, but has a string field that gives the leading matchable UTF-8 bytes; flags field is len
ANYOFR ANYOFR, packed 1 S ; Matches any character in the range given by its packed args: upper 12 bits is the max delta from the base lower 20; the flags field contains the lowest matchable UTF-8 start byte
ANYOFRb ANYOFR, packed 1 S ; Like ANYOFR, but all matches share the same UTF-8 start byte, given in the flags field
-# There is no ANYOFRr because khw doesn't think there are likely to be real-world cases where such a large range is used.
+# There is no ANYOFRr because khw doesn't think there are likely to be
+# real-world cases where such a large range is used.
+#
+# And khw doesn't believe an ANYOFRs (which would behave like ANYOFHs) is
+# actually worth it. On two-byte UTF-8, the first byte alone is all we need,
+# and ANYOFR already does that. And we don't consider non-Unicode code points
+# or EBCDIC for performance decisions. If we had it, we would be comparing the
+# strings, and if they are equal convert to UV and then test to see if it is in
+# the range. The fast DFA we now use to do the conversion is slower than
+# comparing the strings, but not by much, and negligible in 2 or 3 byte
+# operations. (We don't have to compare the final byte as it has to be
+# different or else this wouldn't be a range.) So we might as well displense
+# with the comparisons that ANYOFRs would do, and go directly to do the
+# conversion .
+
+ANYOFHbbm ANYOFHbbm none bbm S ; Like ANYOFHb, but only for 2-byte UTF-8 characters; uses a bitmap to match the continuation byte
ANYOFM ANYOFM, byte 1 S ; Like ANYOF, but matches an invariant byte as determined by the mask and arg
NANYOFM ANYOFM, byte 1 S ; complement of ANYOFM
#*Literals
# NOTE: the relative ordering of these types is important do not change it
+# By convention, folding nodes begin with EXACTF; A digit 8 is in the name if
+# and only if it it requires a UTF-8 target string in order to successfully
+# match.
EXACT EXACT, str ; Match this string (flags field is the length).
# they would fold to something that requires UTF-8. SHARP S would normally
# fold to 'ss', but because of /aa, it instead folds to a pair of LATIN SMALL
# LETTER LONG S characters (U+017F)
-EXACTFAA EXACT, str ; Like EXACT, but match using /iaa rules; (string folded except in non-UTF8 patterns: MICRO, SHARP S; folded length <= unfolded)
+EXACTFAA EXACT, str ; Like EXACT, but match using /iaa rules; (string folded except MICRO in non-UTF8 patterns; doesn't contain SHARP S unless UTF-8; folded length <= unfolded)
+# must immediately follow EXACTFAA
+EXACTFAA_NO_TRIE EXACT, str ; Like EXACTFAA, (string not UTF-8, folded except: MICRO, SHARP S; folded length <= unfolded, not currently trie-able)
# End of important relative ordering.
-EXACTFUP EXACT, str ; Like EXACT, but match using /iu rules; (string not UTF-8, folded except MICRO, SHARP S: hence Problematic)
+EXACTFUP EXACT, str ; Like EXACT, but match using /iu rules; (string not UTF-8, folded except MICRO: hence Problematic)
# In order for a non-UTF-8 EXACTFAA to think the pattern is pre-folded when
# matching a UTF-8 target string, there would have to be something like an
# EXACTFAA_MICRO which would not be considered pre-folded for UTF-8 targets,
# representable in the UTF-8 target string.
EXACTFLU8 EXACT, str ; Like EXACTFU, but use /il, UTF-8, (string is folded, and everything in it is above 255
-EXACTFAA_NO_TRIE EXACT, str ; Like EXACT, but match using /iaa rules (string not UTF-8, not guaranteed to be folded, not currently trie-able)
-
-
EXACT_REQ8 EXACT, str ; Like EXACT, but only UTF-8 encoded targets can match
LEXACT_REQ8 EXACT, len:str 1 ; Like LEXACT, but only UTF-8 encoded targets can match
EXACTFU_REQ8 EXACT, str ; Like EXACTFU, but only UTF-8 encoded targets can match
#* (one character per match) are implemented with STAR
#* and PLUS for speed and to minimize recursive plunges.
#*
-STAR STAR, node 0 V ; Match this (simple) thing 0 or more times.
-PLUS PLUS, node 0 V ; Match this (simple) thing 1 or more times.
+STAR STAR, node 0 V ; Match this (simple) thing 0 or more times: /A{0,}B/ where A is width 1 char
+PLUS PLUS, node 0 V ; Match this (simple) thing 1 or more times: /A{1,}B/ where A is width 1 char
-CURLY CURLY, sv 2 V ; Match this simple thing {n,m} times.
-CURLYN CURLY, no 2 V ; Capture next-after-this simple thing
-CURLYM CURLY, no 2 V ; Capture this medium-complex thing {n,m} times.
-CURLYX CURLY, sv 2 V ; Match this complex thing {n,m} times.
+CURLY CURLY, sv 2 V ; Match this (simple) thing {n,m} times: /A{m,n}B/ where A is width 1 char
+CURLYN CURLY, no 2 V ; Capture next-after-this simple thing: /(A){m,n}B/ where A is width 1 char
+CURLYM CURLY, no 2 V ; Capture this medium-complex thing {n,m} times: /(A){m,n}B/ where A is fixed-length
+CURLYX CURLY, sv 2 V ; Match/Capture this complex thing {n,m} times.
#*This terminator creates a loop structure for CURLYX
WHILEM WHILEM, no 0 V ; Do curly processing and see if rest matches.
#*Control what to keep in $&.
KEEPS KEEPS, no ; $& begins here.
+#*Validate that lookbehind IFMATCH and UNLESSM end at the right place
+LOOKBEHIND_END END, no ; Return from lookbehind (IFMATCH/UNLESSM) and validate position
+
# NEW STUFF SOMEWHERE ABOVE THIS LINE. Stuff that regexec.c: find_byclass()
# and regrepeat() use should go way above, near LNBREAK to allow a more compact
# jump table to be generated for their switch() statements