Vacuum all input from a Reader and then treat it like a StringStream. Manage the buffer manually to avoid unnecessary data copying.

If you need encoding, use ANTLRInputStream.

Hierarchy

Implements

Index

Constructors

constructor

  • new ANTLRReaderStream(input?: string, data?: string[], numberOfActualCharsInArray?: number, sourceName?: string): ANTLRReaderStream
  • Copy data in string to a local char array

    Parameters

    • Optional input: string
    • Default value data: string[] = input.split("")
    • Default value numberOfActualCharsInArray: number = input != null ? input.length : null
    • Default value sourceName: string = null

    Returns ANTLRReaderStream

Properties

charPositionInLine

charPositionInLine: number = 0

The index of the character relative to the beginning of the this.line 0..n-1

Protected data

data: string[]

The data being scanned

initialBufferSize

initialBufferSize: number = 1024

Protected lastMarker

lastMarker: number

Track the last mark() call result value for use in rewind().

line

line: number = 1

this.line number 1..n within the input

Protected markDepth

markDepth: number = 0

tracks how deep mark() calls are nested

Protected markers

A list of CharStreamState objects that tracks the stream state values this.line, this.charPositionInLine, and this.p that can change as you move through the input stream. Indexed from 1..markDepth. A null is kept @ index 0. Create upon first call to mark().

Protected n

n: number

How many characters are actually in the buffer

name

name: string

What is name or source of this char stream?

Protected p

p: number = 0

0..n-1 index into string of next char

readBufferSize

readBufferSize: number = 1024

Accessors

count

  • get count(): number

index

  • get index(): number
  • Return the current input symbol index 0..n where n indicates the last symbol has been read. The index is the index of char to be returned from LA(1).

    Returns number

sourceName

  • get sourceName(): string

Methods

consume

  • consume(): void

implements

  • implements(): any[]

la

  • la(i: number): number

lt

  • lt(i: number): number

mark

  • mark(): number

release

  • release(marker: number): void

reset

  • reset(): void
  • Reset the stream so that it's in the same state it was when the object was created except the data array is not touched.

    Returns void

rewind

  • rewind(m?: number): void

seek

  • seek(index: number): void
  • consume() ahead until this.p==index; can't just set this.p=index as we must update this.line and this.charPositionInLine.

    Parameters

    • index: number

    Returns void

substring

  • substring(start: number, length: number): string

toString

  • toString(): string

Generated using TypeDoc