antlr-ng
Version:
Next generation ANTLR Tool
24 lines (23 loc) • 1.08 kB
TypeScript
import type { IGrammar } from "../types.js";
export declare class TokenVocabParser {
private outputDirectory;
private libDirectory?;
protected readonly g: IGrammar;
constructor(g: IGrammar, outputDirectory: string, libDirectory?: string | undefined);
/**
* Loads a vocab file `<vocabName>.tokens` and return mapping.
*
* @returns A map of token names to token types.
*/
load(): Map<string, number>;
/**
* Return the content of the vocab file. Look in library or in -o output path. antlr -o foo T.g4 U.g4 where U
* needs T.tokens won't work unless we look in foo too. If we do not find the file in the lib directory then must
* assume that the .tokens file is going to be generated as part of this build and we have defined .tokens files
* so that they ALWAYS are generated in the base output directory, which means the current directory for the
* command line tool if there was no output directory specified.
*
* @returns The content of the vocab file.
*/
getImportedVocabFile(): string;
}