Skip to main content

Module codes

Module codes 

Source
Expand description

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

Hashing and comparison of strings and of ranges of code units, without creating strings. The values of the tokens are ranges of the code units of the source: a string and a range with the same content have the same hash (30 bits).

Enums§

CodeUnits
code units of the css source: the bytes of an ascii input, the utf-16 code units otherwise. shared (reference counted): the tokenizer, the string table and the sources reference the same buffer

Traits§

Unit
a code unit: a byte of an ascii input or an utf-16 code unit

Functions§

hash_range
hash of a range of code units (case sensitive). same value as hash_string for the same code units
hash_range_lower
hash of a range of code units, ignoring the case. -1 when the range contains a non ascii character that cannot match an ascii key
hash_string
hash of a string (case sensitive), over its utf-16 code units. same value as hash_range
hash_string_lower
hash of a string ignoring the case, see hash_range_lower
hash_units
hash of utf-16 code units (case sensitive)
lower_ascii
lowercase ascii code of a code unit: the ascii uppercase letters and the kelvin sign are lowercased. -1 for the other non ascii code units