Skip to main content

Module first

Module first 

Source
Expand description

Port of src/validation/first.ts: first token sets of the validation syntaxes.

The typescript caches are WeakMaps keyed by the syntax objects. The rust caches are keyed by the address of the shared syntax tokens / sequences: an entry keeps the syntax alive (the address is not reused) and a sequence entry is checked element by element (Rc::ptr_eq).

Structs§

AlternativeIndex
the alternatives of a syntax indexed by their first tokens
FirstSet
the first tokens of a syntax
TypeSet
set of token types (bitset)

Functions§

first_of
first tokens of a syntax token
first_of_sequence
first tokens of a sequence of syntaxes
is_nullable
true if the syntax may match no token
matching_alternatives
the alternatives of a syntax that may match the first token of a value, in order. None when all of them may match
may_start_with
true if a sequence of syntaxes may match tokens starting with a token