forked from jasder/antlr
errors should display literal if no token name avail.
This commit is contained in:
parent
fdc46c53e6
commit
0355f17f04
|
@ -284,7 +284,7 @@ public class DOTGenerator {
|
|||
SetTransition set = (SetTransition)edge;
|
||||
String label = set.label().toString();
|
||||
if ( isLexer ) label = set.label().toString(true);
|
||||
else if ( grammar!=null ) label = set.label().toString(grammar.getTokenNames());
|
||||
else if ( grammar!=null ) label = set.label().toString(grammar.getTokenDisplayNames());
|
||||
if ( edge instanceof NotSetTransition ) label = "~"+label;
|
||||
edgeST.add("label", getEdgeLabel(label));
|
||||
}
|
||||
|
@ -293,7 +293,7 @@ public class DOTGenerator {
|
|||
RangeTransition range = (RangeTransition)edge;
|
||||
String label = range.label().toString();
|
||||
if ( isLexer ) label = range.toString();
|
||||
else if ( grammar!=null ) label = range.label().toString(grammar.getTokenNames());
|
||||
else if ( grammar!=null ) label = range.label().toString(grammar.getTokenDisplayNames());
|
||||
edgeST.add("label", getEdgeLabel(label));
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -1121,7 +1121,7 @@ public class Grammar implements AttributeResolver {
|
|||
|
||||
char[] serializedAtn = ATNSerializer.getSerializedAsChars(atn);
|
||||
ATN deserialized = new ATNDeserializer().deserialize(serializedAtn);
|
||||
return new LexerInterpreter(fileName, Arrays.asList(getTokenNames()), Arrays.asList(getRuleNames()), ((LexerGrammar)this).modes.keySet(), deserialized, input);
|
||||
return new LexerInterpreter(fileName, Arrays.asList(getTokenDisplayNames()), Arrays.asList(getRuleNames()), ((LexerGrammar)this).modes.keySet(), deserialized, input);
|
||||
}
|
||||
|
||||
public ParserInterpreter createParserInterpreter(TokenStream tokenStream) {
|
||||
|
@ -1131,6 +1131,6 @@ public class Grammar implements AttributeResolver {
|
|||
|
||||
char[] serializedAtn = ATNSerializer.getSerializedAsChars(atn);
|
||||
ATN deserialized = new ATNDeserializer().deserialize(serializedAtn);
|
||||
return new ParserInterpreter(fileName, Arrays.asList(getTokenNames()), Arrays.asList(getRuleNames()), deserialized, tokenStream);
|
||||
return new ParserInterpreter(fileName, Arrays.asList(getTokenDisplayNames()), Arrays.asList(getRuleNames()), deserialized, tokenStream);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue