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

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

Introduction

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

Prototype

String getLiteralName(int tokenType);

Source Link

Document

Gets the string literal associated with a token type.

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  .j  a v a 2  s.c  o  m
    }
    return names.build();
}