Interface

ParserAPI

src/api/parser.ts:36

Supported high-level parser surface. Tokenization, RPN conversion, and parser-stack machinery remain internal implementation details even though Nerdamer itself uses them across modules.

Members

create(): ParserAPIMethod

Creates another parser facade backed by the shared parser configuration.

Returns

ParserAPI

evaluate(str: string, values?: ParserValuesObject): ParserEntityMethod

Parses and evaluates Nerdamer notation with optional substitutions.

Parameters

NameTypeDescription
strstringNerdamer notation or expression-compatible input.
valuesParserValuesObjectValues substituted by name while parsing.

Returns

ParserEntity

get(setting: K): indexedAccessMethod

Returns one shared parser setting with the value type associated with that setting.

Parameters

NameTypeDescription
settingK—

Returns

indexedAccess

getI(): stringMethod

Returns the symbol currently used for the imaginary unit.

Returns

string

getPrecision(): numberMethod

Returns the active Decimal precision.

Returns

number

isReserved(name: string): booleanMethod

Returns whether Nerdamer currently reserves a variable or symbol name.

Parameters

NameTypeDescription
namestring—

Returns

boolean

scopedBlock(setting: K, value: indexedAccess, callback: (): ParserEntity): ParserEntityMethod

Temporarily changes one Boolean parser setting while a callback runs.

Parameters

NameTypeDescription
settingKBoolean setting name to change.
valueindexedAccessTemporary value for that setting.
callback(): ParserEntityWork to perform before restoring the previous setting.

Returns

ParserEntity

set(setting: K, value: indexedAccess): ParserAPIMethod

Changes one shared parser setting and returns the parser for chaining.

Parameters

NameTypeDescription
settingKSupported parser setting name.
valueindexedAccessValue associated with that setting.

Returns

ParserAPI

setConstants(constants: ParserConstants): voidMethod

Registers or removes parser constants.

Parameters

NameTypeDescription
constantsParserConstantsConstant names mapped to values or deletion markers.

Returns

void

setI(variable: string): ParserAPIMethod

Changes the symbol used for the imaginary unit.

Parameters

NameTypeDescription
variablestringNew imaginary-unit symbol.

Returns

ParserAPI

setImaginary(variable: string): ParserAPIMethod

Alias for ParserAPI.setI.

Parameters

NameTypeDescription
variablestringNew imaginary-unit symbol.

Returns

ParserAPI

setPrecision(precision: number): voidMethod

Changes the Decimal precision used by numerical calculations.

Parameters

NameTypeDescription
precisionnumberSignificant decimal digits to retain.

Returns

void