C# Класс Antlr.Runtime.Lexer

* A lexer is recognizer that draws input symbols from a character stream. * lexer grammars result in a subclass of this object. A Lexer object * uses simplified match() and error recovery mechanisms in the interest * of speed. *
Наследование: BaseRecognizer, ITokenSource
Показать файл Открыть проект

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

Свойство Тип Описание
input ICharStream

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

Метод Описание
Emit ( ) : IToken

* The standard method called to automatically emit a token at the * outermost lexical rule. The token object should point into the * char buffer start..stop. If there is a text override in 'text', * use that to set the token's text. Override this method to emit * custom Token objects. *

* If you are building trees, then you should also override * Parser or TreeParser.getMissingSymbol(). *

Emit ( IToken token ) : void

* Currently does not support multiple emits per nextToken invocation * for efficiency reasons. Subclass and override this method and * nextToken (to push tokens into a list and pull from that list rather * than a single variable as this implementation does). *

GetCharErrorDisplay ( int c ) : string
GetEndOfFileToken ( ) : IToken
GetErrorMessage ( RecognitionException e, string tokenNames ) : string
Lexer ( )
Lexer ( ICharStream input )
Lexer ( ICharStream input, Antlr.Runtime.RecognizerSharedState state )
Match ( int c ) : void
Match ( string s ) : void
MatchAny ( ) : void
MatchRange ( int a, int b ) : void
NextToken ( ) : IToken

Return a token from this source; i.e., match a token on the char stream.

Recover ( RecognitionException re ) : void

* Lexers can normally match any char in it's vocabulary after matching * a token, so do the easy thing and just kill a character and hope * it all works out. You can instead use the rule invocation stack * to do sophisticated error recovery if you are in a fragment rule. *

ReportError ( RecognitionException e ) : void
Reset ( ) : void
Skip ( ) : void

* Instruct the lexer to skip creating a token for current lexer rule * and look for another token. nextToken() knows to keep looking when * a lexer rule finishes with token set to SKIP_TOKEN. Recall that * if token==null at end of any token rule, it creates one for you * and emits it. *

mTokens ( ) : void

This is the lexer entry point that sets instance var 'token'

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

Метод Описание
ParseNextToken ( ) : void

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

Метод Описание
TraceIn ( string ruleName, int ruleIndex ) : void
TraceOut ( string ruleName, int ruleIndex ) : void

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

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

* The standard method called to automatically emit a token at the * outermost lexical rule. The token object should point into the * char buffer start..stop. If there is a text override in 'text', * use that to set the token's text. Override this method to emit * custom Token objects. *
* If you are building trees, then you should also override * Parser or TreeParser.getMissingSymbol(). *
public Emit ( ) : IToken
Результат IToken

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

* Currently does not support multiple emits per nextToken invocation * for efficiency reasons. Subclass and override this method and * nextToken (to push tokens into a list and pull from that list rather * than a single variable as this implementation does). *
public Emit ( IToken token ) : void
token IToken
Результат void

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

public GetCharErrorDisplay ( int c ) : string
c int
Результат string

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

public GetEndOfFileToken ( ) : IToken
Результат IToken

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

public GetErrorMessage ( RecognitionException e, string tokenNames ) : string
e RecognitionException
tokenNames string
Результат string

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

public Lexer ( )

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

public Lexer ( ICharStream input )
input ICharStream

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

public Lexer ( ICharStream input, Antlr.Runtime.RecognizerSharedState state )
input ICharStream
state Antlr.Runtime.RecognizerSharedState

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

public Match ( int c ) : void
c int
Результат void

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

public Match ( string s ) : void
s string
Результат void

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

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

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

public MatchRange ( int a, int b ) : void
a int
b int
Результат void

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

Return a token from this source; i.e., match a token on the char stream.
public NextToken ( ) : IToken
Результат IToken

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

protected ParseNextToken ( ) : void
Результат void

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

* Lexers can normally match any char in it's vocabulary after matching * a token, so do the easy thing and just kill a character and hope * it all works out. You can instead use the rule invocation stack * to do sophisticated error recovery if you are in a fragment rule. *
public Recover ( RecognitionException re ) : void
re RecognitionException
Результат void

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

public ReportError ( RecognitionException e ) : void
e RecognitionException
Результат void

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

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

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

* Instruct the lexer to skip creating a token for current lexer rule * and look for another token. nextToken() knows to keep looking when * a lexer rule finishes with token set to SKIP_TOKEN. Recall that * if token==null at end of any token rule, it creates one for you * and emits it. *
public Skip ( ) : void
Результат void

mTokens() публичный абстрактный Метод

This is the lexer entry point that sets instance var 'token'
public abstract mTokens ( ) : void
Результат void

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

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

Where is the lexer drawing characters from?
protected ICharStream input
Результат ICharStream