C# Класс Nexus.Client.Util.Antlr.AntlrLexerBase

The base lexer for ANTRL lexers.
This extends the generated lexer in order to make error handling sane, and to make the errors friendlier.
Наследование: Antlr.Runtime.Lexer
Показать файл Открыть проект

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

Метод Описание
AntlrLexerBase ( ) : System

The default constructor.

AntlrLexerBase ( ICharStream input, Antlr.Runtime.RecognizerSharedState state ) : System

A simple constructor.

DisplayRecognitionError ( String tokenNames, RecognitionException e ) : void

Logs the given error to the ErrorTracker.

GetErrorMessage ( RecognitionException e, string tokenNames ) : string

Generates a human-readable error message for the given error.

NextToken ( ) : IToken

This reads the next token from the input.

If there is a lexing error, this method inserts an error token containing the bad input, and continues lexing.

ReportError ( RecognitionException e ) : void

Reports the given error.

This ensures that the error is thrown so that our NextToken() override can handle it.

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

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

The default constructor.
public AntlrLexerBase ( ) : System
Результат System

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

A simple constructor.
public AntlrLexerBase ( ICharStream input, Antlr.Runtime.RecognizerSharedState state ) : System
input ICharStream The code to lex.
state Antlr.Runtime.RecognizerSharedState The to use.
Результат System

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

Logs the given error to the ErrorTracker.
public DisplayRecognitionError ( String tokenNames, RecognitionException e ) : void
tokenNames String The names of the tokens in the current language.
e Antlr.Runtime.RecognitionException The error.
Результат void

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

Generates a human-readable error message for the given error.
public GetErrorMessage ( RecognitionException e, string tokenNames ) : string
e Antlr.Runtime.RecognitionException The error.
tokenNames string The names of the tokens in the current language.
Результат string

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

This reads the next token from the input.
If there is a lexing error, this method inserts an error token containing the bad input, and continues lexing.
public NextToken ( ) : IToken
Результат IToken

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

Reports the given error.
This ensures that the error is thrown so that our NextToken() override can handle it.
public ReportError ( RecognitionException e ) : void
e Antlr.Runtime.RecognitionException The error.
Результат void