A token stream backed by an Array with a consumed-count cursor.
Replaces Parser.Stream.OfList as the concrete stream under both parsers. OfList stores its
position as the length of a past : List it re-conses on every step, so getPosition — called
on every withBacktracking, every choice alternative, twice per located — is O(n) in the
number of consumed tokens. TokenStream holds the whole token array once and moves an index, so
getPosition/setPosition are O(1) and located is array indexing.
- toks : Array τ
Every token, consumed and remaining. Never changes after construction.
- idx : Nat
Number of tokens consumed; the current position. Always
≤ toks.size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[implicit_reducible]
Equations
- instReprTokenStream = { reprPrec := instReprTokenStream.repr }
@[implicit_reducible]
Equations
- instInhabitedTokenStream = { default := instInhabitedTokenStream.default }
@[inline]
A fresh stream over toks, positioned at the start.
Equations
- TokenStream.ofArray toks = { toks := toks }
Instances For
@[implicit_reducible]
Equations
- One or more equations did not get rendered due to their size.