added -listener and -visitor dependency generation to the command line -depend switch (tool/BuildDependencyGenerator.java); signed contributors.txt file

This commit is contained in:
Stephen Gaito 2012-10-10 15:27:28 +01:00
parent 4c6ee82317
commit 3ff799d359
2 changed files with 30 additions and 0 deletions

View File

@ -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

View File

@ -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<Grammar> imports = g.getAllImportedGrammars();
if ( imports!=null ) {