the test rig did not allow lexer only grammars; a regression.

This commit is contained in:
Terence Parr 2012-09-23 18:05:31 -07:00
parent 262a331a5b
commit bca63c64aa
1 changed files with 11 additions and 6 deletions

View File

@ -154,13 +154,18 @@ public class TestRig {
Constructor<Lexer> lexerCtor = lexerClass.getConstructor(CharStream.class);
Lexer lexer = lexerCtor.newInstance((CharStream)null);
String parserName = grammarName+"Parser";
Class parserClass = cl.loadClass(parserName);
if ( parserClass==null ) {
System.err.println("Can't load "+parserName);
Class parserClass = null;
Parser parser = null;
if ( !startRuleName.equals(LEXER_START_RULE_NAME) ) {
String parserName = grammarName+"Parser";
parserClass = cl.loadClass(parserName);
if ( parserClass==null ) {
System.err.println("Can't load "+parserName);
}
Constructor<Parser> parserCtor = parserClass.getConstructor(TokenStream.class);
parser = parserCtor.newInstance((TokenStream)null);
}
Constructor<Parser> parserCtor = parserClass.getConstructor(TokenStream.class);
Parser parser = parserCtor.newInstance((TokenStream)null);
if ( inputFiles.size()==0 ) {
InputStream is = System.in;