C# Class 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. *
Inheritance: BaseRecognizer, ITokenSource
Afficher le fichier Open project: antlr/antlrcs

Protected Properties

Свойство Type Description
input ICharStream

Méthodes publiques

Méthode Description
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'

Méthodes protégées

Méthode Description
ParseNextToken ( ) : void

Private Methods

Méthode Description
TraceIn ( string ruleName, int ruleIndex ) : void
TraceOut ( string ruleName, int ruleIndex ) : void

Method Details

Emit() public méthode

* 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
Résultat IToken

Emit() public méthode

* 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
Résultat void

GetCharErrorDisplay() public méthode

public GetCharErrorDisplay ( int c ) : string
c int
Résultat string

GetEndOfFileToken() public méthode

public GetEndOfFileToken ( ) : IToken
Résultat IToken

GetErrorMessage() public méthode

public GetErrorMessage ( RecognitionException e, string tokenNames ) : string
e RecognitionException
tokenNames string
Résultat string

Lexer() public méthode

public Lexer ( )

Lexer() public méthode

public Lexer ( ICharStream input )
input ICharStream

Lexer() public méthode

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

Match() public méthode

public Match ( int c ) : void
c int
Résultat void

Match() public méthode

public Match ( string s ) : void
s string
Résultat void

MatchAny() public méthode

public MatchAny ( ) : void
Résultat void

MatchRange() public méthode

public MatchRange ( int a, int b ) : void
a int
b int
Résultat void

NextToken() public méthode

Return a token from this source; i.e., match a token on the char stream.
public NextToken ( ) : IToken
Résultat IToken

ParseNextToken() protected méthode

protected ParseNextToken ( ) : void
Résultat void

Recover() public méthode

* 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
Résultat void

ReportError() public méthode

public ReportError ( RecognitionException e ) : void
e RecognitionException
Résultat void

Reset() public méthode

public Reset ( ) : void
Résultat void

Skip() public méthode

* 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
Résultat void

mTokens() public abstract méthode

This is the lexer entry point that sets instance var 'token'
public abstract mTokens ( ) : void
Résultat void

Property Details

input protected_oe property

Where is the lexer drawing characters from?
protected ICharStream input
Résultat ICharStream