Skip to content

Unicode Set version 1.9.0

Latest

Choose a tag to compare

@kipcole9 kipcole9 released this 20 Sep 00:18

Enhancements

  • Requires unicode ~> 2.2, so every UCD property value resolves, including the @missing defaults (\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 that Zzzz is 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 as 1/6 or 2/12 matched by rational equality, or a decimal such as 0.5 matched 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_parsec ranges 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 version X or earlier, and accepts 6, 6.0.0, 06.00.00, V6_0 and Unassigned/NA as 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 crashes to_regex_string/1, and compile_pattern/1 returns 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 literal N followed 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 0 required, so \7 is U+0007 and \134 is U+005C. Previously \7 was the literal digit and \0 accepted a fourth digit.

  • \cX control escapes accept @ A-Z [ \ ] ^ _ (and lowercase letters as an extension) and compute X AND 0x1F, so \c[ is U+001B; any other character after \c is an error rather than a literal c.

  • [-] 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 ' and a, 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.