The most common stream of tokens is one where every token is buffered up and tokens are prefiltered for a certain channel (the parser will only see these tokens and cannot change the filter channel number during the parse).

TODO: how to access the full token stream? How to track all tokens matched per rule?

Hierarchy

Implements

Index

Constructors

constructor

Properties

Protected _p

_p: number = -1

The index into the tokens list of the current token (next token to consume). tokens[p] should be LT(1). p=-1 indicates need to initialize with first token. The ctor doesn't get a token. First call to LT(1) or whatever gets the first token and sets p=0;

_tokens

_tokens: List<IToken> = new List<IToken>(100)

Record every single token pulled from the source so we can reproduce chunks of it later. The buffer in LookaheadStream overlaps sometimes as its moving window moves through the input. This list captures everything so we can access complete input text.

channel

channel: number

Skip tokens on any channel but this one; this is how we skip whitespace...

maxLookBehind

maxLookBehind: number = Number.MAX_VALUE

range

range: number = 0

How deep have we gone?

Accessors

count

  • get count(): number

index

  • get index(): number

lastRealToken

lastToken

sourceName

  • get sourceName(): string

tokenSource

Methods

consume

  • consume(): void

Protected fetch

  • fetch(n: number): void

fill

  • fill(): void

get

getTokens

  • Given a start and stop index, return a List of all tokens in the token type BitSet. Return null if no tokens were found. This method looks at both on and off channel tokens.

    Parameters

    • start: number
    • stop: number
    • types: BitSet

    Returns List<IToken>

implements

  • implements(): any[]

la

  • la(i: number): number

lb

lt

mark

  • mark(): number

release

  • release(marker: number): void

reset

  • reset(): void

rewind

  • rewind(marker?: number): void

seek

  • seek(index: number): void

setup

  • setup(): void

skipOffTokenChannels

  • skipOffTokenChannels(i: number): number
  • Given a starting index, return the index of the first on-channel token.

    Parameters

    • i: number

    Returns number

Protected skipOffTokenChannelsReverse

  • skipOffTokenChannelsReverse(i: number): number
  • Parameters

    • i: number

    Returns number

Protected sync

  • sync(i: number): void
  • Make sure index i in tokens has a token.

    Parameters

    • i: number

    Returns void

toString

  • toString(): string

toString2

  • toString2(start: number, stop: number): string

Generated using TypeDoc