C# (CSharp) Antlr4.Runtime 네임스페이스

중첩된 네임스페이스

Antlr4.Runtime.Atn
Antlr4.Runtime.Dfa
Antlr4.Runtime.Misc
Antlr4.Runtime.Sharpen
Antlr4.Runtime.Test
Antlr4.Runtime.Tree

클래스들

이름 설명
AntlrFileStream This is an ANTLRInputStream that is loaded from a file all at once when you construct the object.
AntlrInputStream Vacuum all input from a Reader/InputStream and then treat it like a char[] buffer.
BailErrorStrategy This implementation of IAntlrErrorStrategy responds to syntax errors by immediately canceling the parse operation with a ParseCanceledException . The implementation ensures that the ParserRuleContext.exception field is set for all parse tree nodes that were not completed prior to encountering the error.

This error strategy is useful in the following scenarios.

  • Two-stage parsing: This error strategy allows the first stage of two-stage parsing to immediately terminate if an error is encountered, and immediately fall back to the second stage. In addition to avoiding wasted work by attempting to recover from errors here, the empty implementation of Sync(Parser) improves the performance of the first stage.
  • Silent validation: When syntax errors are not being reported or logged, and the parse result is simply ignored if errors occur, the BailErrorStrategy avoids wasting work on recovering from errors when the result will be ignored either way.

myparser.setErrorHandler(new BailErrorStrategy());

BaseErrorListener Provides an empty default implementation of IAntlrErrorListener{Symbol} . The default implementation of each method does nothing, but can be overridden as necessary.
BufferedTokenStream This implementation of ITokenStream loads tokens from a ITokenSource on-demand, and places the tokens in a buffer to provide access to any previous token by index.

This token stream ignores the value of IToken.Channel() . If your parser requires the token stream filter tokens to only those on a particular channel, such as TokenConstants.DefaultChannel or TokenConstants.HiddenChannel , use a filtering token stream such a CommonTokenStream .

CommonToken
CommonTokenFactory This default implementation of ITokenFactory creates CommonToken objects.
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.

DefaultErrorStrategy This is the default implementation of IAntlrErrorStrategy used for error reporting and recovery in ANTLR parsers.
DiagnosticErrorListener This implementation of IAntlrErrorListener{Symbol} can be used to identify certain potential correctness and performance problems in grammars. "Reports" are made by calling Parser.NotifyErrorListeners(string) with the appropriate message.
  • Ambiguities: These are cases where more than one path through the grammar can match the input.
  • Weak context sensitivity: These are cases where full-context prediction resolved an SLL conflict to a unique alternative which equaled the minimum alternative of the SLL conflict.
  • Strong (forced) context sensitivity: These are cases where the full-context prediction resolved an SLL conflict to a unique alternative, and the minimum alternative of the SLL conflict was found to not be a truly viable alternative. Two-stage parsing cannot be used for inputs where this situation occurs.
FailedPredicateException
InputMismatchException
IntStreamConstants
InterpreterRuleContext This class extends ParserRuleContext by allowing the value of RuleIndex() to be explicitly set for the context.

ParserRuleContext does not include field storage for the rule index since the context classes created by the code generator override the RuleIndex() method to return the correct value for that context. Since the parser interpreter does not use the context classes generated for a parser, this class (with slightly more memory overhead per node) is used to provide equivalent functionality.

LexerInterpreter
LexerNoViableAltException
ListTokenSource Provides an implementation of ITokenSource as a wrapper around a list of IToken objects.

If the final token in the list is an TokenConstants.EOF token, it will be used as the EOF token for every call to NextToken() after the end of the list is reached. Otherwise, an EOF token will be created.

NoViableAltException
ParserInterpreter A parser simulator that mimics what ANTLR's generated parser code does.
RecognitionException
RuleContextWithAltNum A handy class for use with options {contextSuperClass=org.antlr.v4.runtime.RuleContextWithAltNum;} that provides a property for the outer alternative number matched for an internal parse tree node.
RuleDependencyAttribute
RuleVersionAttribute
TokenConstants
TokenTypes
UnbufferedCharStream Do not buffer up the entire char stream.
UnbufferedTokenStream
Vocabulary This class provides a default implementation of the IVocabulary interface.