Package org.antlr.mojo.antlr4
Class Antlr4Mojo.CustomTool
java.lang.Object
org.antlr.v4.Tool
org.antlr.mojo.antlr4.Antlr4Mojo.CustomTool
- Enclosing class:
- Antlr4Mojo
-
Nested Class Summary
Nested classes/interfaces inherited from class org.antlr.v4.Tool
Tool.Option, Tool.OptionArgType -
Field Summary
Fields inherited from class org.antlr.v4.Tool
ALL_GRAMMAR_EXTENSIONS, args, errMgr, exact_output_dir, force_atn, gen_dependencies, gen_listener, gen_visitor, generate_ATN_dot, genPackage, GRAMMAR_EXTENSION, grammarEncoding, grammarFiles, grammarOptions, haveOutputDir, inputDirectory, internalOption_PrintGrammarTree, internalOption_ShowATNConfigsInDFA, launch_ST_inspector, LEGACY_GRAMMAR_EXTENSION, libDirectory, log, logMgr, longMessages, msgFormat, optionDefs, outputDirectory, return_dont_exit, ST_inspector_wait_for_close, VERSION, warnings_are_errors -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.antlr.v4.Tool
addListener, checkForRuleIssues, createGrammar, error, exit, findOptionValueAST, generateATNs, getImportedGrammarFile, getListeners, getNumErrors, getOutputDirectory, handleArgs, handleOptionSetArg, help, info, loadGrammar, loadImportedGrammar, log, log, main, panic, parse, parseGrammar, parseGrammarFromString, processGrammarsOnCommandLine, processNonCombinedGrammar, removeListener, removeListeners, sortGrammarByTokenVocab, version, warning, writeDOTFile, writeDOTFile
-
Constructor Details
-
CustomTool
-
-
Method Details
-
process
Description copied from class:ToolTo 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 -
getOutputFileWriter
Description copied from class:ToolThis 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:
getOutputFileWriterin classTool- Throws:
IOException
-