Interface TwingTokenStream

interface TwingTokenStream {
    current: Token;
    source: TwingSource;
    expect(type: TokenType, value?:
        | null
        | string
        | number
        | string[], message?: null | string): Token;
    injectTokens(tokens: Token[]): void;
    isEOF(): boolean;
    look(number: number): Token;
    next(): Token;
    nextIf(primary: TokenType, secondary?: string | string[]): Token;
    test(type: TokenType, value?: string | number | string[]): boolean;
    toAst(): Token[];
}

Properties

current: Token
source: TwingSource

Methods

  • Tests a token and returns it or throws a syntax error.

    Parameters

    • type: TokenType
    • Optionalvalue:
          | null
          | string
          | number
          | string[]
    • Optionalmessage: null | string

    Returns Token