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§
- Code
Units - 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_stringfor 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