Skip to main content

Module strings

Module strings 

Source
Expand description

Port of src/ast/strings.ts.

String table of an arena. An interned string is a range of a text:

  • a range of the code units of a source file: the values of the tokens read by the tokenizer. the table stores the source index and the start and end offsets, no string is created. the code units buffer is shared with the tokenizer (reference counted): it is not copied
  • a range of the canonical text: the spelling of the known units and function names
  • a range of the pool: the code units of the strings that are not a range of a source
  • a string: the strings interned by StringTable::intern

Strings are created when they are read (StringTable::get), once per id, as shared Rc<str>.

Modules§

StringSource
where the code units of an interned string are stored. a value that is not negative is the index of a source

Structs§

SharedStr
a string shared without a copy: a shared string, or a range of the bytes of an ascii source (the source buffer is shared). it derefs to &str, a clone increments a reference count
StringBuilder
builds a string from code units, strings and interned strings, then interns it: no string is created
StringTable
interned strings of an arena
StringTableData
copy of a string table, see StringTable::export

Enums§

StringDerived
values derived from the strings computed once per string id
StringFlag
boolean properties of the strings computed once per string id. 4 flags at most
Units
the code units of a string, borrowed (see StringTable::with_units): ascii bytes or utf-16 code units