Class ParseTreeBuilder

java.lang.Object
com.lucaskjaerozhang.wikitext_parser.parse.ParseTreeBuilder

public class ParseTreeBuilder extends Object
Here we invoke antlr to build the parse tree.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    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
    visitTreeFromText(String text, com.lucaskjaerozhang.wikitext_parser.preprocess.template.TemplateProvider provider)
    Does the parsing with default settings.
    visitTreeFromText(String text, com.lucaskjaerozhang.wikitext_parser.preprocess.template.TemplateProvider provider, boolean trace)
    Does the parsing with the option to enable trace logs.
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 parse
      listeners - 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 parse
      listeners - 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 parse
      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)
      Does the parsing with default settings.
      Parameters:
      text - The text to parse
      Returns:
      The AST built from the input.