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
파일 보기 프로젝트 열기: sharwell/antlr4cs 1 사용 예제들

보호된 프로퍼티들

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