Class Antlr4Mojo.CustomTool

java.lang.Object
org.antlr.v4.Tool
org.antlr.mojo.antlr4.Antlr4Mojo.CustomTool
Enclosing class:
Antlr4Mojo

private final class Antlr4Mojo.CustomTool extends Tool
  • Constructor Details

    • CustomTool

      public CustomTool(String[] args)
  • Method Details

    • process

      public void process(Grammar g, boolean gencode)
      Description copied from class: Tool
      To process a grammar, we load all of its imported grammars into subordinate grammar objects. Then we merge the imported rules into the root grammar. If a root grammar is a combined grammar, we have to extract the implicit lexer. Once all this is done, we process the lexer first, if present, and then the parser grammar
      Overrides:
      process in class Tool
    • getOutputFileWriter

      public Writer getOutputFileWriter(Grammar g, String fileName) throws IOException
      Description copied from class: Tool
      This method is used by all code generators to create new output files. If the outputDir set by -o is not present it will be created. The final filename is sensitive to the output directory and the directory where the grammar file was found. If -o is /tmp and the original grammar file was foo/t.g4 then output files go in /tmp/foo. The output dir -o spec takes precedence if it's absolute. E.g., if the grammar file dir is absolute the output dir is given precedence. "-o /tmp /usr/lib/t.g4" results in "/tmp/T.java" as output (assuming t.g4 holds T.java). If no -o is specified, then just write to the directory where the grammar file was found. If outputDirectory==null then write a String.
      Overrides:
      getOutputFileWriter in class Tool
      Throws:
      IOException