The factory that returns the code of the reader function. The produced code assigns the reader result for
inputVar
and offsetVar
to resultVar
. The produced code must be a semicolon-terminated statement.
const abcReaderCodegenFactory: ReaderCodegenFactory = (inputVar, offsetVar, contextVar, resultVar) => {
const abcVar = Symbol();
return {
code: [resultVar, '=', inputVar, '.startsWith(', abcVar, ',', offsetVar, ')?', offsetVar, '+3:-1;'],
bindings: [[abcVar, 'abc']],
};
};
The variable that holds the input string.
The variable that holds the offset in the input string from which the reader must be applied.
The variable that holds the reader context.
The variable to which the reader result must be assigned.
The source code and required variable bindings.
Generated using TypeDoc
Factory that returns the reader code and values for variables that must be bound to the reader.