Class ParseTreeBuilder
java.lang.Object
com.lucaskjaerozhang.wikitext_parser.parse.ParseTreeBuilder
Here we invoke antlr to build the parse tree.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic com.lucaskjaerozhang.wikitext_parser.grammar.parse.WikiTextLexer
getLexerFromText
(String text, List<org.antlr.v4.runtime.ANTLRErrorListener> listeners) Creates a lexer from the given text.static com.lucaskjaerozhang.wikitext_parser.grammar.parse.WikiTextParser
getParserFromText
(String text, com.lucaskjaerozhang.wikitext_parser.preprocess.template.TemplateProvider provider, List<org.antlr.v4.runtime.ANTLRErrorListener> listeners, boolean trace) Builds the parse treestatic WikiTextNode
visitTreeFromText
(String text, com.lucaskjaerozhang.wikitext_parser.preprocess.template.TemplateProvider provider) Does the parsing with default settings.static WikiTextNode
visitTreeFromText
(String text, com.lucaskjaerozhang.wikitext_parser.preprocess.template.TemplateProvider provider, boolean trace) Does the parsing with the option to enable trace logs.static WikiTextNode
visitTreeFromText
(String text, com.lucaskjaerozhang.wikitext_parser.preprocess.template.TemplateProvider provider, List<org.antlr.v4.runtime.ANTLRErrorListener> listeners, boolean trace) Does the parsing with the included error listeners and the option to enable trace logs.
-
Constructor Details
-
ParseTreeBuilder
public ParseTreeBuilder()
-
-
Method Details
-
getLexerFromText
public static com.lucaskjaerozhang.wikitext_parser.grammar.parse.WikiTextLexer getLexerFromText(String text, List<org.antlr.v4.runtime.ANTLRErrorListener> listeners) Creates a lexer from the given text. You probably want a parser.- Parameters:
text
- The text to run the lexer on.listeners
- Error listeners to notify if there is a problem during lexing.- Returns:
- The lexer after it has completed running.
-
getParserFromText
public static com.lucaskjaerozhang.wikitext_parser.grammar.parse.WikiTextParser getParserFromText(String text, com.lucaskjaerozhang.wikitext_parser.preprocess.template.TemplateProvider provider, List<org.antlr.v4.runtime.ANTLRErrorListener> listeners, boolean trace) Builds the parse tree- Parameters:
text
- The text to parselisteners
- Error listeners to notify if there is a problem during parsing.trace
- Whether to give trace logs when parsing. You only want this during testing.- Returns:
- The parse tree.
-
visitTreeFromText
public static WikiTextNode visitTreeFromText(String text, com.lucaskjaerozhang.wikitext_parser.preprocess.template.TemplateProvider provider, List<org.antlr.v4.runtime.ANTLRErrorListener> listeners, boolean trace) Does the parsing with the included error listeners and the option to enable trace logs.- Parameters:
text
- The text to parselisteners
- Error listeners to notify if there is a problem during parsing.trace
- Whether to give trace logs when parsing. You only want this during testing.- Returns:
- The AST built from the input.
-
visitTreeFromText
public static WikiTextNode visitTreeFromText(String text, com.lucaskjaerozhang.wikitext_parser.preprocess.template.TemplateProvider provider, boolean trace) Does the parsing with the option to enable trace logs.- Parameters:
text
- The text to parsetrace
- Whether to give trace logs when parsing. You only want this during testing.- Returns:
- The AST built from the input.
-
visitTreeFromText
public static WikiTextNode visitTreeFromText(String text, com.lucaskjaerozhang.wikitext_parser.preprocess.template.TemplateProvider provider) Does the parsing with default settings.- Parameters:
text
- The text to parse- Returns:
- The AST built from the input.
-