Merge branch 'master' into enhance-ctx

This commit is contained in:
Terence Parr 2012-02-13 17:36:56 -08:00
commit 0031075da2
2 changed files with 8 additions and 2 deletions

View File

@ -303,6 +303,7 @@ public class CodeGenerator {
* TListener.java, if we're using the Java target. * TListener.java, if we're using the Java target.
*/ */
public String getListenerFileName() { public String getListenerFileName() {
assert g.name != null;
ST extST = templates.getInstanceOf("codeFileExtension"); ST extST = templates.getInstanceOf("codeFileExtension");
String listenerName = g.name + "Listener"; String listenerName = g.name + "Listener";
return listenerName+extST.render(); return listenerName+extST.render();
@ -312,6 +313,7 @@ public class CodeGenerator {
* such as BlankTListener.java, if we're using the Java target. * such as BlankTListener.java, if we're using the Java target.
*/ */
public String getBlankListenerFileName() { public String getBlankListenerFileName() {
assert g.name != null;
ST extST = templates.getInstanceOf("codeFileExtension"); ST extST = templates.getInstanceOf("codeFileExtension");
String listenerName = "Blank" + g.name + "Listener"; String listenerName = "Blank" + g.name + "Listener";
return listenerName+extST.render(); return listenerName+extST.render();

View File

@ -42,10 +42,14 @@ public class TestCompositeGrammars extends BaseTest {
String grammar = String grammar =
"parser grammar S;\n" + "parser grammar S;\n" +
"a : B . C ;\n"; // not qualified ID "a : B . C ;\n"; // not qualified ID
Grammar g = new Grammar(grammar); mkdir(tmpdir);
Grammar g = new Grammar(tmpdir + "/S.g", grammar);
g.name = "S";
ErrorQueue equeue = new ErrorQueue(); ErrorQueue equeue = new ErrorQueue();
Tool antlr = new Tool(); Tool antlr = g.tool;
antlr.outputDirectory = tmpdir;
antlr.libDirectory = tmpdir;
antlr.addListener(equeue); antlr.addListener(equeue);
antlr.process(g,true); antlr.process(g,true);