InternedGreen<E, Tok, Syn> class final

Runs inner and interns its produced green through the parse-scoped GreenCache, replacing the value with the canonical instance so structurally-equal greens across the parse collapse to one heap object.

Opt-in via the internToken / internTree combinators. Same one-case-one-handler integration as Memo: the interpreter reads the cache from ParserState; no other parser case threads it.

Inheritance

Constructors

InternedGreen(Parser<E, GreenNode<Tok, Syn>> inner)
Creates an interning wrapper.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
inner Parser<E, GreenNode<Tok, Syn>>
The parser whose produced green is interned.
final
isSimple bool
True if this parser cannot consume input on failure. Used to skip save/restore in Many/Choice/Or loops.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

interpretWith(Result<E, GreenNode<T0, S0>> run<T0, S0>(InternedGreen<E, T0, S0>)) Result<E, GreenNode<Tok, Syn>>
Dispatch to the interpreter with Tok/Syn reified. Mirrors the pattern used by Mapped/Zip/Pratt: routing through this instance method keeps the receiver's generic parameters at runtime, so the handler produces a Result<E, GreenNode<Tok, Syn>> with the precise types rather than GreenNode<dynamic, dynamic> (which would not cast back under Dart's invariant generics).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited