VocabularyImpl constructor

VocabularyImpl(
  1. List<String?> literalNames,
  2. List<String?> symbolicNames, [
  3. List<String?> displayNames = EMPTY_NAMES
])

Constructs a new instance of VocabularyImpl from the specified literal, symbolic, and display token names.

@param literalNames The literal names assigned to tokens, or null if no literal names are assigned. @param symbolicNames The symbolic names assigned to tokens, or null if no symbolic names are assigned. @param displayNames The display names assigned to tokens, or null to use the values in literalNames and symbolicNames as the source of display names, as described in {@link #getDisplayName(int)}.

@see #getLiteralName(int) @see #getSymbolicName(int) @see #getDisplayName(int)

Implementation

VocabularyImpl(
  this.literalNames,
  this.symbolicNames, [
  this.displayNames = EMPTY_NAMES,
]) {
  // See note here on -1 part: https://github.com/antlr/antlr4/pull/1146
  maxTokenType = max(displayNames.length,
          max(literalNames.length, symbolicNames.length)) -
      1;
}