Skip to content

SourceInfo

SourceInfo collects source metadata for a parsed expression.

new SourceInfo(syntax?, desc?, lines?, baseLine?, baseCol?, extensions?): SourceInfo

string = ""

string = ""

number[] = []

number = 0

number = 0

Extension[] = []

SourceInfo

addExtension(extension): void

AddExtension appends an extension descriptor.

Extension

void


clearMacroCall(id): void

ClearMacroCall removes the macro call stored for an expression id.

number

void


clearOffsetRange(id): void

ClearOffsetRange removes the source offset range for an expression id.

number

void


computeOffset(line, column): number

ComputeOffset converts a line and column to an absolute source offset.

number

number

number


description(): string

Description returns the source description.

string


extensions(): Extension[]

Extensions returns the enabled extension list.

Extension[]


getMacroCall(id): [Expr | undefined, boolean]

GetMacroCall looks up the macro call for an expression id.

number

[Expr | undefined, boolean]


getOffsetRange(id): [OffsetRange | undefined, boolean]

GetOffsetRange looks up the source offset range for an expression id.

number

[OffsetRange | undefined, boolean]


getStartLocation(id): Location

GetStartLocation returns the start location for an expression id.

number

Location


getStopLocation(id): Location

GetStopLocation returns the stop location for an expression id.

number

Location


hasExtension(id, version): boolean

HasExtension reports whether a compatible extension is enabled.

string

ExtensionVersion

boolean


lineOffsets(): number[]

LineOffsets returns the stored line offsets.

number[]


macroCalls(): Map<number, Expr>

MacroCalls returns the stored macro call expressions.

Map<number, Expr>


offsetRanges(): Map<number, OffsetRange>

OffsetRanges returns the expression id to offset range map.

Map<number, OffsetRange>


renumberIds(generator): void

RenumberIds rewrites stored ids using the provided generator.

IdGenerator

void


setMacroCall(id, expr): void

SetMacroCall stores the macro call for an expression id.

number

Expr

void


setOffsetRange(id, range): void

SetOffsetRange stores the source offset range for an expression id.

number

OffsetRange

void


syntaxVersion(): string

SyntaxVersion returns the source syntax version.

string