C# Класс Antlr4.Runtime.UnbufferedCharStream

Do not buffer up the entire char stream.
Do not buffer up the entire char stream. It does keep a small buffer for efficiency and also buffers while a mark exists (set by the lookahead prediction in parser). "Unbuffered" here refers to fact that it doesn't buffer all data, not that's it's on demand loading of char.
Наследование: ICharStream
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
name string

Защищенные свойства (Protected)

Свойство Тип Описание
currentCharIndex int
data char[]
input System.IO.TextReader
lastChar int
lastCharBufferStart int
n int
numMarkers int
p int

Открытые методы

Метод Описание
Consume ( ) : void
GetText ( Interval interval ) : string
La ( int i ) : int
Mark ( ) : int

Return a marker that we can release later.

Return a marker that we can release later.

The specific marker value used for this class allows for some level of protection against misuse where seek() is called on a mark or release() is called in the wrong order.

Release ( int marker ) : void

Decrement number of markers, resetting buffer if we hit 0.

Seek ( int index ) : void

Seek to absolute character index, which might not be in the current sliding window.

Seek to absolute character index, which might not be in the current sliding window. Move p to index-bufferStartIndex .

UnbufferedCharStream ( ) : System

Useful for subclasses that pull char from other than this.input.

UnbufferedCharStream ( Stream input ) : System
UnbufferedCharStream ( Stream input, int bufferSize ) : System
UnbufferedCharStream ( TextReader input ) : System
UnbufferedCharStream ( TextReader input, int bufferSize ) : System
UnbufferedCharStream ( int bufferSize ) : System

Useful for subclasses that pull char from other than this.input.

Защищенные методы

Метод Описание
Add ( int c ) : void
Fill ( int n ) : int

Add n characters to the buffer. Returns the number of characters actually added to the buffer. If the return value is less than n , then EOF was reached before n characters could be added.

NextChar ( ) : int

Override to provide different source of characters than input .

Sync ( int want ) : void

Make sure we have 'need' elements from current position p . Last valid p index is data.length-1 . p+need-1 is the char index 'need' elements ahead. If we need 1 element, (p+1-1)==p must be less than data.length .

Описание методов

Add() защищенный метод

protected Add ( int c ) : void
c int
Результат void

Consume() публичный метод

public Consume ( ) : void
Результат void

Fill() защищенный метод

Add n characters to the buffer. Returns the number of characters actually added to the buffer. If the return value is less than n , then EOF was reached before n characters could be added.
protected Fill ( int n ) : int
n int
Результат int

GetText() публичный метод

public GetText ( Interval interval ) : string
interval Antlr4.Runtime.Misc.Interval
Результат string

La() публичный метод

public La ( int i ) : int
i int
Результат int

Mark() публичный метод

Return a marker that we can release later.
Return a marker that we can release later.

The specific marker value used for this class allows for some level of protection against misuse where seek() is called on a mark or release() is called in the wrong order.

public Mark ( ) : int
Результат int

NextChar() защищенный метод

Override to provide different source of characters than input .
protected NextChar ( ) : int
Результат int

Release() публичный метод

Decrement number of markers, resetting buffer if we hit 0.
public Release ( int marker ) : void
marker int
Результат void

Seek() публичный метод

Seek to absolute character index, which might not be in the current sliding window.
Seek to absolute character index, which might not be in the current sliding window. Move p to index-bufferStartIndex .
public Seek ( int index ) : void
index int
Результат void

Sync() защищенный метод

Make sure we have 'need' elements from current position p . Last valid p index is data.length-1 . p+need-1 is the char index 'need' elements ahead. If we need 1 element, (p+1-1)==p must be less than data.length .
protected Sync ( int want ) : void
want int
Результат void

UnbufferedCharStream() публичный метод

Useful for subclasses that pull char from other than this.input.
public UnbufferedCharStream ( ) : System
Результат System

UnbufferedCharStream() публичный метод

public UnbufferedCharStream ( Stream input ) : System
input Stream
Результат System

UnbufferedCharStream() публичный метод

public UnbufferedCharStream ( Stream input, int bufferSize ) : System
input Stream
bufferSize int
Результат System

UnbufferedCharStream() публичный метод

public UnbufferedCharStream ( TextReader input ) : System
input System.IO.TextReader
Результат System

UnbufferedCharStream() публичный метод

public UnbufferedCharStream ( TextReader input, int bufferSize ) : System
input System.IO.TextReader
bufferSize int
Результат System

UnbufferedCharStream() публичный метод

Useful for subclasses that pull char from other than this.input.
public UnbufferedCharStream ( int bufferSize ) : System
bufferSize int
Результат System

Описание свойств

currentCharIndex защищенное свойство

Absolute character index.
Absolute character index. It's the index of the character about to be read via LA(1) . Goes from 0 to the number of characters in the entire stream, although the stream size is unknown before the end is reached.
protected int currentCharIndex
Результат int

data защищенное свойство

A moving window buffer of the data being scanned.
A moving window buffer of the data being scanned. While there's a marker, we keep adding to buffer. Otherwise, consume() resets so we start filling at index 0 again.
protected char[] data
Результат char[]

input защищенное свойство

protected TextReader,System.IO input
Результат System.IO.TextReader

lastChar защищенное свойство

This is the LA(-1) character for the current position.
protected int lastChar
Результат int

lastCharBufferStart защищенное свойство

When numMarkers > 0 , this is the LA(-1) character for the first character in data . Otherwise, this is unspecified.
protected int lastCharBufferStart
Результат int

n защищенное свойство

The number of characters currently in data .

This is not the buffer capacity, that's data.length .

protected int n
Результат int

name публичное свойство

The name or source of this char stream.
public string name
Результат string

numMarkers защищенное свойство

Count up with mark() and down with release() . When we release() the last mark, numMarkers reaches 0 and we reset the buffer. Copy data[p]..data[n-1] to data[0]..data[(n-1)-p] .
protected int numMarkers
Результат int

p защищенное свойство

0..n-1 index into data of next character.

The LA(1) character is data[p] . If p == n , we are out of buffered characters.

protected int p
Результат int