Options
All
  • Public
  • Public/Protected
  • All
Menu

This class stores state assocated with the parser

TODO reduce public API's

Hierarchy

  • default

Index

Constructors

Properties

globals: {}

Type declaration

includedFiles: {} = {}

Type declaration

initialStackSize: number = 0
minStackSize: number = 0
module: default
optLevel: number
scopes: {}[] = ...
stack: Value[] = []
trace: Value[] = []
traceResults: Map<Value, TraceResultTracker> = ...
warnings: { msg: string; token: LexerToken }[] = []
TraceResults: typeof TraceResults = TraceResults

Methods

  • cmpStack(old: Value[]): number
  • Get index for first value on stack that hasn't been seen before

    deprecated

    Parameters

    • old: Value[]

      index for first value on stack that hasn't been seen before

    Returns number

  • copyState(): { globals: {}; initialStackSize: number; minStackSize: number; module: default; scopes: {}[]; stack: Value[]; trace: Value[]; traceResults: Map<Value, TraceResultTracker>; warnings: { msg: string; token: LexerToken }[] }
  • Copy Context state

    Returns { globals: {}; initialStackSize: number; minStackSize: number; module: default; scopes: {}[]; stack: Value[]; trace: Value[]; traceResults: Map<Value, TraceResultTracker>; warnings: { msg: string; token: LexerToken }[] }

    state copy object

    • globals: {}
    • initialStackSize: number
    • minStackSize: number
    • module: default
    • scopes: {}[]
    • stack: Value[]
    • trace: Value[]
    • traceResults: Map<Value, TraceResultTracker>
    • warnings: { msg: string; token: LexerToken }[]
  • getId(id: string[]): Value
  • Look up identifier

    Parameters

    • id: string[]

      identifier

    Returns Value

    returns value stored if found

  • Invoke macro or function

    Parameters

    • v: Value

      value to invoke

    • token: LexerToken

      location in source

    • isTrace: boolean = false

      is this a trace invoke? or normal?

    Returns default | SyntaxError

    • null if recursive trace, error.SyntaxError on error, this on success
  • outWasm(): Promise<Uint8Array>
  • Use Compiles program to WebAssembly Text and then uses WABT to convert to binary

    Returns Promise<Uint8Array>

    • Wasm binary buffer
  • outWast(options: Object): Promise<string>
  • Compiles program to WASM Text form

    Parameters

    • options: Object

      settings

    Returns Promise<string>

    • WAST source code
  • Pull multiple values from stack

    retuns

    {Value[]} - list of values from stack

    Parameters

    • n: number

    Returns Value[]

  • push(...v: Value[]): void
  • Push value onto stack

    Parameters

    • Rest ...v: Value[]

      push something on to the stack

    Returns void

  • restoreState(obj: any): void
  • Restore copied state

    Parameters

    • obj: any

      state copy object from Context.copyState()

    Returns void

  • Warn the user when something seems weird

    Parameters

    • token: LexerToken

      location in code

    • msg: string

      what's wrong

    Returns void

Generated using TypeDoc