Search in sources :

Example 1 with TokenVocabParser

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));
        }
    }
}
Also used : TokenVocabParser(org.antlr.v4.parse.TokenVocabParser)

Aggregations

TokenVocabParser (org.antlr.v4.parse.TokenVocabParser)1