C# Class Nexus.Client.Util.Antlr.AntlrParserBase

The base parser for ANTLR parsers.
This extends the generated parser in order to make error handling sane, and to make the errors friendlier.
Inheritance: Antlr.Runtime.Parser
Exibir arquivo Open project: NexusMods/NexusModManager-4.5

Public Methods

Method Description
AntlrParserBase ( ITokenStream 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.

Parse ( ) : ITree

Parses the input.

Method Details

AntlrParserBase() public method

A simple constructor.
public AntlrParserBase ( ITokenStream input, Antlr.Runtime.RecognizerSharedState state ) : System
input ITokenStream The token stream to parse.
state Antlr.Runtime.RecognizerSharedState The to use.
return System

DisplayRecognitionError() public method

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.
return void

GetErrorMessage() public method

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.
return string

Parse() public abstract method

Parses the input.
public abstract Parse ( ) : ITree
return ITree