This site describes solve-engine as it is on main: 2.43.0, which npm does not have yet. npm installs 2.40.0, so a page may show an answer that version does not give yet.
PhraseAlternative
Defined in: packages/engine/src/parser/PhrasePattern.ts:54
One alternative phrasing of a pattern. The FIRST slot must be a
keyword slot. This is what lets definePhrasePattern choose
which alternative applies via a single parser.peek(), before
consuming or emitting anything. Bytecode is append-only
(BytecodeBuilder has no rollback), so an alternative can only be
committed to, never speculatively tried and abandoned, every phrase
grammar in this codebase is naturally leading-keyword-disambiguated
(that’s what makes it parseable as a phrase at all), so this is not a
real limitation in practice.
Properties
Section titled “Properties”slots: PhraseSlot[];Defined in: packages/engine/src/parser/PhrasePattern.ts:55
Methods
Section titled “Methods”emit()
Section titled “emit()”emit(builder, captures): void;Defined in: packages/engine/src/parser/PhrasePattern.ts:62
Called once every slot has been consumed (and every expr slot’s
bytecode already emitted, in slot order). Emit whatever final
opcode(s) turn the already-pushed operands into a result here
e.g. builder.emitOpcode(OpCode.CALL_BUILTIN); builder.emitIndex(...).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
builder | BytecodeBuilder |
captures | PhraseCapture[] |
Returns
Section titled “Returns”void