Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TokenStream

Hierarchy

  • TokenStream

Index

Constructors

constructor

Accessors

current

tokens

Methods

injectTokens

  • injectTokens(tokens: Token[]): void

look

  • look(number?: number): Token

next

nextIf

  • nextIf(primary: TokenType, secondary?: Array<string> | string): Token
  • Test the current token, then, if the test is successful, sets the pointer to the next one and returns the tested token.

    Parameters

    • primary: TokenType
    • Default value secondary: Array<string> | string = null

    Returns Token

    The next token if the condition is true, null otherwise

rewind

  • rewind(): void

serialize

  • serialize(): string

test

  • test(type: TokenType, value?: string | string[] | number): boolean
  • Test the current token.

    Parameters

    • type: TokenType
    • Default value value: string | string[] | number = null

    Returns boolean

toAst

toString

  • toString(): string

traverse

  • traverse(visitor: TokenVisitor): Token[]

Generated using TypeDoc