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

Наследование: ITokenStream
Показать файл Открыть проект

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

Свойство Тип Описание
currentTokenIndex int
lastToken IToken
lastTokenBufferStart IToken
n int
numMarkers int
p int
tokens IToken[]

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

Метод Описание
Consume ( ) : void
Get ( int i ) : IToken
LA ( int i ) : int
LT ( int i ) : IToken
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
Seek ( int index ) : void
UnbufferedTokenStream ( ITokenSource tokenSource ) : System
UnbufferedTokenStream ( ITokenSource tokenSource, int bufferSize ) : System

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

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

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

GetBufferStartIndex ( ) : int
Sync ( int want ) : void

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

Приватные методы

Метод Описание
GetText ( ) : string
GetText ( IToken start, IToken stop ) : string
GetText ( Interval interval ) : string
GetText ( RuleContext ctx ) : string

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

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

protected Add ( IToken t ) : void
t IToken
Результат void

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

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

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

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

Get() публичный Метод

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

GetBufferStartIndex() защищенный Метод

protected GetBufferStartIndex ( ) : int
Результат int

LA() публичный Метод

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

LT() публичный Метод

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

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

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

public Release ( int marker ) : void
marker int
Результат void

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

public Seek ( int index ) : void
index int
Результат void

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

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

UnbufferedTokenStream() публичный Метод

public UnbufferedTokenStream ( ITokenSource tokenSource ) : System
tokenSource ITokenSource
Результат System

UnbufferedTokenStream() публичный Метод

public UnbufferedTokenStream ( ITokenSource tokenSource, int bufferSize ) : System
tokenSource ITokenSource
bufferSize int
Результат System

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

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

Absolute token index.
Absolute token index. It's the index of the token about to be read via LT(1) . Goes from 0 to the number of tokens in the entire stream, although the stream size is unknown before the end is reached.

This value is used to set the token indexes if the stream provides tokens that implement IWritableToken .

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

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

This is the LT(-1) token for the current position.
protected IToken lastToken
Результат IToken

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

When numMarkers > 0 , this is the LT(-1) token for the first token in tokens . Otherwise, this is .
protected IToken lastTokenBufferStart
Результат IToken

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

The number of tokens currently in tokens .

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

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

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

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

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

0..n-1 index into tokens of next token.

The LT(1) token is tokens[p] . If p == n , we are out of buffered tokens.

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

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

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 IToken[] tokens
Результат IToken[]