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

This class extends BufferedTokenStream with functionality to filter token streams to tokens on a particular channel (tokens where IToken.Channel() returns a particular value).

This token stream provides access to all tokens by index or when calling methods like BufferedTokenStream.GetText() . The channel filtering is only used for code accessing tokens via the lookahead methods BufferedTokenStream.La(int) , Lt(int) , and Lb(int) .

By default, tokens are placed on the default channel ( TokenConstants.DefaultChannel ), but may be reassigned by using the ->channel(HIDDEN) lexer command, or by using an embedded action to call Lexer.Channel .

Note: lexer rules which use the ->skip lexer command or call Lexer.Skip() do not produce tokens at all, so input text matched by such a rule will not be available as part of the token stream, regardless of channel.

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

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

Свойство Тип Описание
channel int

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

Метод Описание
CommonTokenStream ( ITokenSource tokenSource ) : Antlr4.Runtime.Sharpen

Constructs a new CommonTokenStream using the specified token source and the default token channel ( TokenConstants.DefaultChannel ).

CommonTokenStream ( ITokenSource tokenSource, int channel ) : Antlr4.Runtime.Sharpen

Constructs a new CommonTokenStream using the specified token source and filtering tokens to the specified channel. Only tokens whose IToken.Channel() matches channel or have the IToken.Type() equal to TokenConstants.Eof will be returned by the token stream lookahead methods.

GetNumberOfOnChannelTokens ( ) : int

Count EOF just once.

Lt ( int k ) : IToken

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

Метод Описание
AdjustSeekIndex ( int i ) : int
Lb ( int k ) : IToken

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

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

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

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

Constructs a new CommonTokenStream using the specified token source and the default token channel ( TokenConstants.DefaultChannel ).
public CommonTokenStream ( ITokenSource tokenSource ) : Antlr4.Runtime.Sharpen
tokenSource ITokenSource The token source.
Результат Antlr4.Runtime.Sharpen

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

Constructs a new CommonTokenStream using the specified token source and filtering tokens to the specified channel. Only tokens whose IToken.Channel() matches channel or have the IToken.Type() equal to TokenConstants.Eof will be returned by the token stream lookahead methods.
public CommonTokenStream ( ITokenSource tokenSource, int channel ) : Antlr4.Runtime.Sharpen
tokenSource ITokenSource The token source.
channel int The channel to use for filtering tokens.
Результат Antlr4.Runtime.Sharpen

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

Count EOF just once.
public GetNumberOfOnChannelTokens ( ) : int
Результат int

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

protected Lb ( int k ) : IToken
k int
Результат IToken

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

public Lt ( int k ) : IToken
k int
Результат IToken

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

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

Specifies the channel to use for filtering tokens.
Specifies the channel to use for filtering tokens.

The default value is TokenConstants.DefaultChannel , which matches the default channel assigned to tokens created by the lexer.

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