.tokens files goes in output dir like parser file.

This commit is contained in:
Terence Parr 2012-11-17 16:25:51 -08:00
parent e366f00820
commit b1a3370934
3 changed files with 6 additions and 12 deletions

View File

@ -1,5 +1,9 @@
ANTLR v4 Honey Badger
November 17, 2012
* .tokens files goes in output dir like parser file.
November 11, 2012
* Change version to 4.0b4 (btw, forgot to push 4.0b3 in build.properties when

View File

@ -40,7 +40,6 @@ import org.antlr.v4.automata.ATNFactory;
import org.antlr.v4.automata.LexerATNFactory;
import org.antlr.v4.automata.ParserATNFactory;
import org.antlr.v4.codegen.CodeGenPipeline;
import org.antlr.v4.codegen.CodeGenerator;
import org.antlr.v4.misc.Graph;
import org.antlr.v4.parse.ANTLRLexer;
import org.antlr.v4.parse.ANTLRParser;
@ -609,16 +608,7 @@ public class Tool {
}
// output directory is a function of where the grammar file lives
// for subdir/T.g4, you get subdir here. Well, depends on -o etc...
// But, if this is a .tokens file, then we force the output to
// be the base output directory (or current directory if there is not a -o)
//
File outputDir;
if ( fileName.endsWith(CodeGenerator.VOCAB_FILE_EXTENSION) ) {
outputDir = new File(outputDirectory);
}
else {
outputDir = getOutputDirectory(g.fileName);
}
File outputDir = getOutputDirectory(g.fileName);
File outputFile = new File(outputDir, fileName);
if (!outputDir.exists()) {

View File

@ -213,7 +213,7 @@ public class CodeGenerator {
ST tokenVocabSerialization = getTokenVocabOutput();
String fileName = getVocabFileName();
if ( fileName!=null ) {
write(tokenVocabSerialization, fileName);
target.genFile(g, tokenVocabSerialization, fileName);
}
}