Example usage for org.antlr.v4.runtime Vocabulary getMaxTokenType

List of usage examples for org.antlr.v4.runtime Vocabulary getMaxTokenType

Introduction

In this page you can find the example usage for org.antlr.v4.runtime Vocabulary getMaxTokenType.

Prototype

int getMaxTokenType();

Source Link

Document

Returns the highest token type value.

Usage

From source file:com.facebook.presto.sql.ReservedIdentifiers.java

License:Apache License

private static Set<String> possibleIdentifiers() {
    ImmutableSet.Builder<String> names = ImmutableSet.builder();
    Vocabulary vocabulary = SqlBaseLexer.VOCABULARY;
    for (int i = 0; i <= vocabulary.getMaxTokenType(); i++) {
        String name = nullToEmpty(vocabulary.getLiteralName(i));
        Matcher matcher = IDENTIFIER.matcher(name);
        if (matcher.matches()) {
            names.add(matcher.group(1));
        }// w  ww .ja  v  a2s  . co  m
    }
    return names.build();
}