diff --git a/contributors.txt b/contributors.txt index f8efe67b2..ece449beb 100644 --- a/contributors.txt +++ b/contributors.txt @@ -50,3 +50,4 @@ CONTRIBUTORS: YYYY/MM/DD, github id, Full name, email 2012/07/12, parrt, Terence Parr, parrt@antlr.org 2012/09/18, sharwell, Sam Harwell, sam@tunnelvisionlabs.com +2012/10/10, stephengaito, Stephen Gaito, stephen@percepitsys.co.uk diff --git a/tool/src/org/antlr/v4/tool/BuildDependencyGenerator.java b/tool/src/org/antlr/v4/tool/BuildDependencyGenerator.java index c3bc14cdd..71f4e532a 100644 --- a/tool/src/org/antlr/v4/tool/BuildDependencyGenerator.java +++ b/tool/src/org/antlr/v4/tool/BuildDependencyGenerator.java @@ -47,6 +47,18 @@ import java.util.List; * T.tokens : T.g * TLexer.java : T.g * + * If we are using the listener pattern (-listener on the command line) + * then we add: + * + * TListener.java : T.g + * TBaseListener.jave : T.g + * + * If we are using the visitor pattern (-visitor on the command line) + * then we add: + * + * TVisitor.java : T.g + * TBaseVisitor.java : T.g + * * If "-lib libdir" is used on command-line with -depend and option * tokenVocab=A in grammar, then include the path like this: * @@ -109,6 +121,8 @@ public class BuildDependencyGenerator { String suffix = Grammar.getGrammarTypeToFileNameSuffix(ANTLRParser.LEXER); String lexer = g.name + suffix + extST.render(); files.add(getOutputFile(lexer)); + String lexerTokens = g.name + suffix + ".tokens"; + files.add(getOutputFile(lexerTokens)); // TLexer.h if (headerExtST != null) { @@ -118,6 +132,21 @@ public class BuildDependencyGenerator { // for combined, don't generate TLexer.tokens } + if ( g.tool.gen_listener ) { + // add generated listener; e.g., TListener.java + files.add(getOutputFile(generator.getListenerFileName())); + // add generated base listener; e.g., TBaseListener.java + files.add(getOutputFile(generator.getBaseListenerFileName())); + } + + if ( g.tool.gen_visitor ) { + // add generated visitor; e.g., TVisitor.java + files.add(getOutputFile(generator.getVisitorFileName())); + // add generated base visitor; e.g., TBaseVisitor.java + files.add(getOutputFile(generator.getBaseVisitorFileName())); + } + + // handle generated files for imported grammars List imports = g.getAllImportedGrammars(); if ( imports!=null ) {