UNPKG

1.97 kBTypeScriptView Raw
1/*!
2 * Copyright 2016 The ANTLR Project. All rights reserved.
3 * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
4 */
5import { Vocabulary } from "./Vocabulary";
6/**
7 * This class provides a default implementation of the {@link Vocabulary}
8 * interface.
9 *
10 * @author Sam Harwell
11 */
12export declare class VocabularyImpl implements Vocabulary {
13 /**
14 * Gets an empty {@link Vocabulary} instance.
15 *
16 * No literal or symbol names are assigned to token types, so
17 * {@link #getDisplayName(int)} returns the numeric value for all tokens
18 * except {@link Token#EOF}.
19 */
20 static readonly EMPTY_VOCABULARY: VocabularyImpl;
21 private readonly literalNames;
22 private readonly symbolicNames;
23 private readonly displayNames;
24 private _maxTokenType;
25 /**
26 * Constructs a new instance of {@link VocabularyImpl} from the specified
27 * literal, symbolic, and display token names.
28 *
29 * @param literalNames The literal names assigned to tokens, or an empty array
30 * if no literal names are assigned.
31 * @param symbolicNames The symbolic names assigned to tokens, or
32 * an empty array if no symbolic names are assigned.
33 * @param displayNames The display names assigned to tokens, or an empty array
34 * to use the values in `literalNames` and `symbolicNames` as
35 * the source of display names, as described in
36 * {@link #getDisplayName(int)}.
37 *
38 * @see #getLiteralName(int)
39 * @see #getSymbolicName(int)
40 * @see #getDisplayName(int)
41 */
42 constructor(literalNames: Array<string | undefined>, symbolicNames: Array<string | undefined>, displayNames: Array<string | undefined>);
43 get maxTokenType(): number;
44 getLiteralName(tokenType: number): string | undefined;
45 getSymbolicName(tokenType: number): string | undefined;
46 getDisplayName(tokenType: number): string;
47}