Files
DefinitelyTyped/types/antlr4/Token.d.ts
Alex Miller 7f757779c4 🤖 Merge PR #62582 [Antlr] Add and fix types for Antlr 4.11 by @Codex-
* antlr: Update tree typings

* antlr: Add some misc typings.

* antlr: Update error types.

* antlr: Add some atn types.

* antlr: Add some contexts.

* antlr: Add some state.

* antlr: Add various.

* antlr: Add some root level types.

* antlr: Complete more types from Parser to dependents.

* antlr: Add many atn types.

* antlr: Finish atn types.

* antlr: Finish DFA types.

* antlr: Clean up types.

* antlr: add utils tests.

* antlr: add dfa tests.

* antlr: add atn tests.

* antlr: add more atn tests.

* antlr: finish atn tests.

* antlr: add action tests.

* antlr: add context tests.

* antlr: finish dfa tests.

* antlr: add error tests.

* antlr: add misc tests.

* antlr: add state tests.

* antlr: add transition tests.

* antlr: add tree tests.

* antlr: add root tests.

* antlr: remove relying on lib.dom.

* antlr: lexer technically handles null.

* antlr4-autosuggest: Update to use new types

* antlr: ParserRuleContext child method actually returns a base ParseTree.
2022-11-02 13:34:43 -07:00

55 lines
1.0 KiB
TypeScript

import InputStream from './InputStream';
import Lexer from './Lexer';
export type TokenSourceTuple = [Lexer, InputStream] | [null, null];
export default class Token {
static readonly INVALID_TYPE: 0;
static readonly EPSILON: -2;
static readonly MIN_USER_TOKEN_TYPE: 1;
static readonly EOF: -1;
static readonly DEFAULT_CHANNEL: 0;
static readonly HIDDEN_CHANNEL: 1;
source: TokenSourceTuple;
type: number;
/**
* The parser ignores everything not on DEFAULT_CHANNEL
*/
channel: number;
/**
* -1 if not implemented.
*/
start: number;
/**
* -1 if not implemented.
*/
stop: number;
/**
* from 0..n-1 of the token object in the input stream
*/
tokenIndex: number;
/**
* line=1..n of the 1st character
*/
line: number;
/**
* beginning of the line at which it occurs, 0..n-1
*/
column: number;
getTokenSource(): TokenSourceTuple;
getInputStream(): InputStream;
set text(text: string);
get text(): string;
}