toK3UnicodeSet

Parses this string into a K3UnicodeSet.

The encoded string is expected to be in the UnicodeSet format, with important restrictions:

  • UnicodeSet property notation (\p{…} or [:…:]) may NOT be used and will be treated as literal text.

  • Unciode character references by name (\N{…name}) may NOT be used and will be rejected.

  • Escaped code points may only occur in the bracketed hex format (\u{…hh}) and may only provide a single code point. Other escape sequences, such as \xhh, \x{…hh}, \uhhhh, \Uhhhhhhhh, \a, \b, \t, \n, \v, \f, and \r will be rejected. An exception is \\, which resolves to the literal backslash (\).

  • Multi-character strings ({…chars}) are not supported, such as [żġħ{ie}{għ}], and will be rejected.

  • Empty strings ({}) are not supported and will be rejected.

  • Variable syntax in the format $…varId is not supported. Instead, the Keyboard3-specific syntax for variable references may be used: ${…varId} for strings, and $[…varId] for usets. Set variables may NOT be referenced.

  • Any string variable must resolve to a string with exactly one codepoint and no markers.

  • Markers are disallowed, both directly or indirectly via referenced string variables.

  • UnicodeSets may not be nested by a depth > 9 in direct notation. For greater depth, uset variable references may be used.

Return

The parsed K3UnicodeSet. Essentially, this parser will build a uset which represents the same code points as the given input uset, but written as a non-negated union of ranges. This allows for efficient runtime search. Due to this parsing behavior, a parsed UnicodeSet may not produce the same syntax during serialization, but it is logically equivalent to the input uset.

Context Parameters

variableResolver

The contextual variable resolver, used for string and uset variable reference resolution.