Class SourceExceptionParser
java.lang.Object
org.opendaylight.yangtools.yang.parser.rfc7950.antlr.SourceExceptionParser
Utility class for converting ANTLRErrorListener errors to SourceExceptions. This class is NOT thread-safe.
- Author:
- Robert Varga
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T
parse
(org.antlr.v4.runtime.Lexer lexer, org.antlr.v4.runtime.Parser parser, Supplier<T> parseMethod, StatementSourceReference ref) Use a Lexer/Parser pair extracting the parser's root item.static <T> T
parse
(org.antlr.v4.runtime.Recognizer<?, ?> recognizer, Supplier<T> parseMethod, StatementSourceReference ref) Parse a Recognizer extracting its root item.
-
Method Details
-
parse
public static <T> T parse(org.antlr.v4.runtime.Recognizer<?, ?> recognizer, Supplier<T> parseMethod, StatementSourceReference ref) Parse a Recognizer extracting its root item.- Parameters:
recognizer
- Recognizer to useparseMethod
- Root item extractor methodref
- Source reference- Returns:
- Parsed item
- Throws:
NullPointerException
- if any argument is nullSourceException
- if a parser error occurs
-
parse
public static <T> T parse(org.antlr.v4.runtime.Lexer lexer, org.antlr.v4.runtime.Parser parser, Supplier<T> parseMethod, StatementSourceReference ref) Use a Lexer/Parser pair extracting the parser's root item.- Parameters:
lexer
- lexer to useparser
- parser to useparseMethod
- Root item extractor methodref
- Source reference- Returns:
- Parsed item
- Throws:
NullPointerException
- if any argument is nullSourceException
- if a parser error occurs
-