ElementFrequenciesVisitor: override stringRef(TerminalAST ref) for correct processing of arrays of string literals

This commit is contained in:
Ivan Kochurkin 2018-09-09 11:55:13 +03:00
parent d3745c7b93
commit 70e3e5de70
1 changed files with 10 additions and 0 deletions

View File

@ -149,6 +149,16 @@ public class ElementFrequenciesVisitor extends GrammarTreeVisitor {
minFrequencies.peek().add(ref.getText());
}
@Override
public void stringRef(TerminalAST ref) {
String tokenName = ref.g.getTokenName(ref.getText());
if (tokenName != null && !tokenName.startsWith("T__")) {
frequencies.peek().add(tokenName);
minFrequencies.peek().add(tokenName);
}
}
/*
* Parser rules
*/