use of org.antlr.v4.parse.TokenVocabParser in project antlr4 by antlr.
the class Grammar method importTokensFromTokensFile.
public void importTokensFromTokensFile() {
String vocab = getOptionString("tokenVocab");
if (vocab != null) {
TokenVocabParser vparser = new TokenVocabParser(this);
Map<String, Integer> tokens = vparser.load();
tool.log("grammar", "tokens=" + tokens);
for (String t : tokens.keySet()) {
if (t.charAt(0) == '\'')
defineStringLiteral(t, tokens.get(t));
else
defineTokenName(t, tokens.get(t));
}
}
}
Aggregations