Unicode Set v0.2.0 Unicode.Set.Operation View Source

Functions to operate on Unicode sets:

  • Intersection
  • Difference
  • Union

Link to this section Summary

Functions

Combines all the ranges into a single list

Removes one list of 2-tuples representing Unicode codepoints from another.

Expands all sets, properties and ranges to a list of 2-tuples expressing a range of codepoints

Returns a boolean indicating whether the given AST includes set operations intersection or difference.

Returns the intersection of two lists of 2-tuples representing codepoint ranges.

Returns a list of 2-tuples representing codepoint ranges that are the full set of Unicode ranges minus the ranges for a given property.

Prewalks the expanded AST from a parsed Unicode Set invoking a function on each codepoint range in the set.

Returns the difference of two lists of 2-tuples representing codepoint ranges.

Merges two lists of 2-tuples representing ranges of codepoints. The result is a single list of 2-tuple codepoint ranges that includes all codepoint from the two lists.

Link to this section Functions

Combines all the ranges into a single list

This function is called iff the Unicode Sets are formed by unions only. If the set operations of intersection or difference are present then the ranges will need to be expanded via expand/1.

Removes one list of 2-tuples representing Unicode codepoints from another.

Returns the first list of codepoint ranges minus the codepoints in the second list.

Expands all sets, properties and ranges to a list of 2-tuples expressing a range of codepoints

Link to this function

has_difference_or_intersection?(arg1)

View Source

Returns a boolean indicating whether the given AST includes set operations intersection or difference.

When these operations exist then all ranges - including ^ ranges needs to be expanded. If there are no intersections or differences then the ^ ranges can be directly translated to guard clauses or a list of elixir ranges.

Returns the intersection of two lists of 2-tuples representing codepoint ranges.

The result is a single list of codepoint ranges that represents the common codepoints in the two lists.

Returns a list of 2-tuples representing codepoint ranges that are the full set of Unicode ranges minus the ranges for a given property.

Prewalks the expanded AST from a parsed Unicode Set invoking a function on each codepoint range in the set.

Link to this function

prewalk(range, var, fun)

View Source
Link to this function

symmetric_difference(this, that)

View Source

Returns the difference of two lists of 2-tuples representing codepoint ranges.

The result is a single list of codepoint ranges that represents the codepoints that are in either of the two lists but not both.

Merges two lists of 2-tuples representing ranges of codepoints. The result is a single list of 2-tuple codepoint ranges that includes all codepoint from the two lists.

It is assumed that both lists are sorted prior to merging.