forked from jasder/antlr
Merge branch 'basetest-error-reporting' of git://github.com/sharwell/antlr4
This commit is contained in:
commit
290833150d
|
@ -389,7 +389,7 @@ public abstract class BaseTest {
|
|||
System.out.println("dir "+tmpdir);
|
||||
mkdir(tmpdir);
|
||||
writeFile(tmpdir, fileName, grammarStr);
|
||||
try {
|
||||
ErrorQueue equeue = new ErrorQueue();
|
||||
final List<String> options = new ArrayList<String>();
|
||||
Collections.addAll(options, extraOptions);
|
||||
options.add("-o");
|
||||
|
@ -397,15 +397,22 @@ public abstract class BaseTest {
|
|||
options.add("-lib");
|
||||
options.add(tmpdir);
|
||||
options.add(new File(tmpdir,grammarFileName).toString());
|
||||
try {
|
||||
final String[] optionsA = new String[options.size()];
|
||||
options.toArray(optionsA);
|
||||
ErrorQueue equeue = new ErrorQueue();
|
||||
Tool antlr = newTool(optionsA);
|
||||
antlr.addListener(equeue);
|
||||
if (defaultListener) {
|
||||
antlr.addListener(new DefaultToolListener(antlr));
|
||||
}
|
||||
antlr.processGrammarsOnCommandLine();
|
||||
}
|
||||
catch (Exception e) {
|
||||
allIsWell = false;
|
||||
System.err.println("problems building grammar: "+e);
|
||||
e.printStackTrace(System.err);
|
||||
}
|
||||
|
||||
allIsWell = equeue.errors.isEmpty();
|
||||
if ( !defaultListener && !equeue.errors.isEmpty() ) {
|
||||
System.err.println("antlr reports errors from "+options);
|
||||
|
@ -424,12 +431,7 @@ public abstract class BaseTest {
|
|||
System.err.println(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
allIsWell = false;
|
||||
System.err.println("problems building grammar: "+e);
|
||||
e.printStackTrace(System.err);
|
||||
}
|
||||
|
||||
return allIsWell;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue