Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Context

Maintain recursive parsing context on a stack.

Hierarchy

  • Context

Index

Properties

Private stack

stack: TokenContext[] = []

the context stack

Private tail

tail: TokenContext = this.ROOT

the current context

Methods

acceptsBreakMarker

  • acceptsBreakMarker(): boolean
  • Check if the current context can accept a break marker

    Returns boolean

    whether the current context accepts break marker tokens

break

  • break(): void
  • Ends this current context.

    Returns void

expected

  • expected(): number
  • Get the number of tokens that are expected in this context

    Returns number

    the length of the current token context

hasExpected

  • hasExpected(): boolean
  • Returns boolean

hasRemaining

  • hasRemaining(): boolean
  • Check if the current context has token remaining to be read

    Returns boolean

    true if there are more tokens expected in this context

next

  • next(): void
  • Progress through the current context's expected value count

    throws

    an InvalidDataError if there are no remaining tokens in the current context

    Returns void

pop

  • Pop the current context

    Returns TokenContext

    the previous tail on the context stack

push

  • Add a new context

    Parameters

    Returns void

read

  • read(): number
  • Get the number of read tokens

    Returns number

    the number of tokens that have been read in the current token context

type

  • Get the context type

    Returns TokenContextType

    the type of the current token context

Object literals

Private Readonly ROOT

ROOT: object

the root context

length

length: number = -1

read

read: number = 0

type

type: root = TokenContextType.root

Copyright © 2025 DiffusionData Ltd. All Rights Reserved.