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
파일 보기 프로젝트 열기: sharwell/antlr4cs

공개 프로퍼티들

프로퍼티 타입 설명
name string

보호된 프로퍼티들

프로퍼티 타입 설명
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