Remove tree parser reference

This commit is contained in:
Sam Harwell 2013-01-02 12:48:58 -06:00
parent 922fe53bdd
commit fbfa61c3dd
2 changed files with 14 additions and 4 deletions

View File

@ -46,7 +46,6 @@ public class ATN {
public static final int PARSER = 1; public static final int PARSER = 1;
public static final int LEXER = 2; public static final int LEXER = 2;
public static final int TREE_PARSER = 3;
@NotNull @NotNull
public final List<ATNState> states = new ArrayList<ATNState>(); public final List<ATNState> states = new ArrayList<ATNState>();

View File

@ -90,9 +90,20 @@ public class ATNSerializer {
IntegerList data = new IntegerList(); IntegerList data = new IntegerList();
data.add(ATNSimulator.SERIALIZED_VERSION); data.add(ATNSimulator.SERIALIZED_VERSION);
// convert grammar type to ATN const to avoid dependence on ANTLRParser // convert grammar type to ATN const to avoid dependence on ANTLRParser
if ( g.getType()== ANTLRParser.LEXER ) data.add(ATN.LEXER); switch (g.getType()) {
else if ( g.getType()== ANTLRParser.PARSER ) data.add(ATN.PARSER); case ANTLRParser.LEXER:
else data.add(ATN.TREE_PARSER); data.add(ATN.LEXER);
break;
case ANTLRParser.PARSER:
case ANTLRParser.COMBINED:
data.add(ATN.PARSER);
break;
default:
throw new UnsupportedOperationException("Invalid grammar type.");
}
data.add(g.getMaxTokenType()); data.add(g.getMaxTokenType());
int nedges = 0; int nedges = 0;