Repository navigation
Enhancements
-
Requires
unicode ~> 2.2, so every UCD property value resolves, including the@missingdefaults (\p{jt=U},\p{bpt=None},\p{sc=Unknown}), separator-bearing aliases such as\p{Bidi_M}, and every character name alias, so\N{NULL},\N{LF}and\N{BYTE ORDER MARK}resolve. Note thatZzzzis now a valid script, so\p{zzzz}is the Unknown script rather than an error. -
\p{Numeric_Value=...}(nv) resolves per UTS #61:NaN, a rational such as1/6or2/12matched by rational equality, or a decimal such as0.5matched by binary64 equality. Previously every numeric value was an error. -
\p{Name=...}(na) and\p{Name_Alias=...}resolve the single character whose name or alias matches under UAX44-LM2, so\p{Name=SPACE}and\p{Name_Alias=NUL}answer as UTS #61 specifies. -
Adds a user guide covering the expression syntax and each use of a set: guards, binary patterns,
nimble_parsecranges and regular expressions. -
Adds the UTS #61 conformance guide, which records how this library's syntax and semantics relate to the draft Unicode Set Notation standard, including every known divergence and extension.
-
\N{HEX:NAME}and\N{HEX:CHAR:NAME}named elements (UTS #61 §2.3) are now supported, and the hex digits and character must agree with the named character. -
\p{Age=X}is cumulative, as in UTS #61 and ICU: it now matches every code point assigned in versionXor earlier, and accepts6,6.0.0,06.00.00,V6_0andUnassigned/NAas values. Previously only the code points first assigned in exactly that version matched.
Bug Fixes
-
A string member whose code points are not in ascending order (such as
{ba}) is no longer expanded into a cartesian product when the set is part of an intersection, difference or complement;to_regex_string("[[{ba}]-[a]]")is now(?:ba), not(?:ab|aa|bb|ba). -
The empty-string member
{}no longer crashesto_regex_string/1, andcompile_pattern/1returns an error rather than raising for it and for the empty set, since a binary pattern cannot match the empty string. -
A malformed
\N{...}escape is reported as an error instead of silently parsing as a literalNfollowed by a string member. -
The non-ASCII Pattern_White_Space characters (U+0085, U+200E, U+200F, U+2028, U+2029) are now ignored between elements as UTS #61 requires, instead of being treated as literal characters.
-
Escapes denoting a value above U+10FFFF, such as
\x{110000}and\U00110000, are rejected as ill-formed instead of producing an invalid code point. -
Octal escapes follow UTS #61 and ICU: one to three octal digits with no leading
0required, so\7is U+0007 and\134is U+005C. Previously\7was the literal digit and\0accepted a fourth digit. -
\cXcontrol escapes accept@ A-Z [ \ ] ^ _(and lowercase letters as an extension) and computeXAND 0x1F, so\c[is U+001B; any other character after\cis an error rather than a literalc. -
[-]and[--]are the one-element set containing U+002D, as UTS #61 specifies;[]remains the empty set, and[ ]and[^ ](empty content with white space) now parse as the empty set and its complement. Previously[-]was the empty set and the others were errors. -
A single quote is an ordinary literal character, so
['a']is the set of'anda, as UTS #61 specifies. The CLDR TR35'...'quoting convention, and''as an escaped quote, are no longer recognised; escape a quote as\'if desired. -
White space and set-syntax characters are literal inside a string member, so
{a b}is the string"a b"and{a-b}contains a hyphen, as UTS #61 requires. Previously white space inside braces was dropped and-,[,]and&were rejected.