Skip to main content

Module canonical

Module canonical 

Source
Expand description

Port of src/parser/utils/canonical.ts.

Canonical strings: the spellings of the known units and function names (dB, translateX, …). They are registered once and stored in a single text: the string table references ranges of this text, no string is created.

Functions§

canonical_code_at
code unit of the canonical text
canonical_end
end of a packed range
canonical_slice
a range of the canonical text
canonical_start
start of a packed range
register_canonical
register a canonical string returns the range of the string in the canonical text, packed: start << 8 | length
with_canonical_text
run a function with the canonical text (ascii: the bytes are the code units)