Skip to content

Commit

Permalink
For the TypeScript target, make sure to export CommonToken, and the m…
Browse files Browse the repository at this point in the history
…ethods from Lexer. These are needed for TypeScript ports of various grammars in grammars-v4. Issue #4110. (#4119)
  • Loading branch information
kaby76 authored Feb 16, 2023
1 parent fbd4452 commit 823ac47
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
8 changes: 8 additions & 0 deletions runtime/JavaScript/src/antlr4/CommonToken.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Token } from "./Token";

export declare class CommonToken extends Token {
constructor(source: number, type: number, channel: number, start: number, stop: number);
clone(): CommonToken;
cloneWithType(type: number): CommonToken;
toString(): string;
}
9 changes: 8 additions & 1 deletion runtime/JavaScript/src/antlr4/Lexer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@ export declare class Lexer extends Recognizer<number> {
_type: number;

constructor(input: CharStream);
reset(): void;
nextToken(): Token;
skip(): void;
more(): void;
more(m: number): void;
pushMode(m: number): void;
popMode(): number;
emitToken(token: Token): void;
emit(): Token;
reset(): void;
emitEOF(): Token;
}
1 change: 1 addition & 0 deletions runtime/JavaScript/src/antlr4/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export * from "./CharStream";
export * from "./CharStreams";
export * from "./TokenStream";
export * from "./BufferedTokenStream";
export * from "./CommonToken";
export * from "./CommonTokenStream";
export * from "./Recognizer";
export * from "./Lexer";
Expand Down

0 comments on commit 823ac47

Please sign in to comment.