Range check; apparently string literal map not set when we create interp vs code gen.

This commit is contained in:
Terence Parr 2013-12-30 15:25:06 -08:00 committed by Sam Harwell
parent 81e8df8119
commit d4275ab53a
1 changed files with 4 additions and 1 deletions

View File

@ -566,7 +566,10 @@ public class Grammar implements AttributeResolver {
String[] tokenNames = new String[numTokens+1];
for (String tokenName : tokenNameToTypeMap.keySet()) {
Integer ttype = tokenNameToTypeMap.get(tokenName);
if ( tokenName!=null && tokenName.startsWith(AUTO_GENERATED_TOKEN_NAME_PREFIX) ) {
if ( tokenName!=null &&
tokenName.startsWith(AUTO_GENERATED_TOKEN_NAME_PREFIX) &&
ttype < typeToStringLiteralList.size() )
{
tokenName = typeToStringLiteralList.get(ttype);
}
if ( ttype>0 ) tokenNames[ttype] = tokenName;