Skip to main content

Module arena

Module arena 

Source
Expand description

Port of src/ast/arena.ts.

Arena memory manager: ast nodes and value tokens are integer ids, their data is stored column-wise (structure of arrays) in Rust owned vectors, lists are doubly linked lists stored in the first_child / last_child / first_token / last_token / next_sibling / previous_sibling columns and strings are interned.

The columns are interior mutable (Column): every method takes &self, like the typescript implementation where the arena is a shared mutable object (visitors re-enter the arena while it is transformed).

Modules§

TokenField
position of the structured token fields in the children list

Structs§

Arena
Arena memory manager.
ArenaProperties
properties of an arena, see Arena::export_properties (Arena.toTransferableArenaObject())
ArenaTransferables
column buffers of an arena, in the order of ARENA_COLUMNS
AstArena
Css ast arena: ast nodes and value tokens. Derefs to Arena (typescript extends).
OptimizedSelector
optimized selector (OptimizedSelector)
RawSelector
a split selector of the minification cache (arena.raw) with its vendor prefixes, computed once. a mutable access clears the prefixes

Enums§

StrOrId
a string or an interned string id (sel: string | number arguments)
TokenValue
a token value: a string or a number (val?: string | number | null)

Constants§

ARENA_COLUMNS
arena columns, in the order of the transferable buffers
SKIP_STATES
the nesting rules of these nodes are not expanded

Functions§

is_js_whitespace
javascript \s
is_node_object_type
true for the node types whose plain object is a node (isNodeObjectType() of arena-node.ts)
is_numeric_token_type
numeric token types: the value is stored in the numeric_value column
is_structured_token_type
token types whose fields are stored as list children (see TokenField)
js_trim
String.prototype.trim()
structured_fields
fields of a structured token type: the plain object key (l, r, op, op1, op2, val), the field index and whether the field holds a single token. empty for the other token types

Type Aliases§

RawSelectorTokens
raw selector (RawSelectorTokens)
SharedOptimizedSelector
optimized selector shared by reference, like the typescript objects (the minifier mutates it in place and a cloned rule shares the object of its source)
StructuredField
plain object key, field and single value flag of a structured token field