UnicodeSet

(async) new UnicodeSet(pattern) → {Promise.<RangeGroup>}

This does not need to be called with new. Parses and evaluates a UnicodeSet string as a RangeGroup. This is an async function as it will lazily load the unicode character name and property data as it is needed.

Parameters:
NameTypeDescription
patternstring

pattern defining the unicode set

Returns:
Type: 
Promise.<RangeGroup>

Members

(static) options :EvaluateOptions

Options to configure group evaluation

Type:
  • EvaluateOptions

Methods

(static) evaluate(node) → {Promise.<RangeGroup>}

Takes an AST as generated from UnicodeSet.parse and evaluates as a RangeGroup

Parameters:
NameTypeDescription
nodeobject

AST node to evaluate

Returns:
Type: 
Promise.<RangeGroup>

(static) lazyEvaluate(node) → {Promise.<LazyGroup>}

Takes an AST as generated from UnicodeSet.parse and evaluates it into a lazily evaluated group

Parameters:
NameTypeDescription
nodeobject

AST node to evaluate

Returns:
Type: 
Promise.<LazyGroup>

(static) parse(pattern) → {Promise.<Node>}

Parse a UnicodeSet pattern into an abstract syntax tree (AST). Some trivial transformations are performed on the tree to reduce groups, combine invert/complement, and combine nodes. The parsing is async, as it lazily loads unicode data as it becomes needed.

Parameters:
NameTypeDescription
patternstring

UnicodeSet pattern

Returns:

the AST root node

Type: 
Promise.<Node>

Type Definitions

EvaluateOptions

Configurable constants for group evaluation

Type:
  • object
Properties
NameTypeDescription
rebuild_thresholdnumber

Threshold for RangeGroup.ranges.length where union op is faster than rebuilding

string_range_1d_maxnumber

Maximum 1D ranges that we allow to be generated from a single multidimensional (ND) string range. This is used to guard against unintended, huge memory usage. The StringRange.toRanges1d method used enumerates all string range dimensions except the last, which could yield many ranges, dependeing on the length of the string.