Repository navigation
3.8
CHANGES:
New features
- Named capture groups:
(r as x)bindsxin the action to a
Sedlexing.submatch, extracted withSedlexing.Utf8.of_submatch,
Latin1.of_submatch,Utf16.of_submatchorlexeme_of_submatch. Both
branches of an or-pattern must bind the same names, andasis not allowed
underStar,Plus,Opt,Rep,Compl,SuborIntersect. Submatches
are chosen leftmost-greedy within the longest match, using a tagged DFA; a
boundary at a fixed offset from the start or end of the lexeme costs nothing
at runtime. A submatch is only valid inside its action (#177, #178, #204,
#208, #209, #212) - Nested
let .. indefinitions of[%sedlex.regexp?](#176) - Unicode 18.0.0 (#205)
Compl,SubandIntersectacceptRep (c, 1 .. 1)(#201)- Clearer errors for a bare
Star,Plus,Opt,Utf8,Latin1orAscii
and for unknown operators (#196)
Bug fixes
- Rule priority with
eof: a rule matchings, eofno longer beats an
earlier rule matchings(#211) - End of input is read once:
Plus eofandStar ('a' | eof)no longer loop
forever at end of input, andeof, eofno longer matches (#211) - Empty character sets (
Chars "",Compl any,SuborIntersectof
coinciding classes) are a compile error instead of crashing the ppx or
producing a rule that never matches (#201) - Rule sets where every rule is nullable, such as a lone
"", no longer
generate invalid code (#201) - UTF-8 decoding: the surrogate range rejected by
Utf8.Helper.check_three
ended at U+DF00 instead of U+DFFF (#184) Sedlexing.sub_lexemeand itsLatin1,Utf8andUtf16versions raise
Invalid_argumentwhen the range is not within the lexeme, instead of
returning code points of the rest of the buffer or, for a negative length,
an empty string (#219)
Performance
- Faster
lexeme,sub_lexemeandof_submatchinSedlexing.Latin1,
Sedlexing.Utf8andSedlexing.Utf16(#219) - The memory cells of
asbindings are no longer cleared at the start of
every token (#220)
Other changes
- Require OCaml 4.11, the oldest compiler still in opam-repository