Files
DefinitelyTyped/types/antlr4/Lexer.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

74 lines
1.9 KiB
TypeScript

import Recognizer from './Recognizer';
import CommonToken from './CommonToken';
import Token from './Token';
import RecognitionException from './error/RecognitionException';
import InputStream from './InputStream';
/**
* A lexer is recognizer that draws input symbols from a character stream.
* lexer grammars result in a subclass of this object. A Lexer object
* uses simplified match() and error recovery mechanisms in the interest of speed.
*/
export default class Lexer extends Recognizer {
static readonly DEFAULT_MODE: 0;
static readonly MORE: -2;
static readonly SKIP: -3;
static readonly DEFAULT_TOKEN_CHANNEL: 0;
static readonly HIDDEN: 1;
static readonly MIN_CHAR_VALUE: 0x0000;
static readonly MAX_CHAR_VALUE: 0x10ffff;
constructor(input: InputStream | null);
reset(): void;
nextToken(): Token;
skip(): void;
more(): void;
mode(m: number): void;
pushMode(mode: number): void;
popMode(): number;
emitToken(token: Token): void;
emit(): CommonToken;
emitEOF(): CommonToken;
charIndex(): number;
getAllTokens(): Token[];
notifyListeners(e: RecognitionException): void;
getErrorDisplay(s: string): string;
getErrorDisplayForChar(c: string): string;
getCharErrorDisplay(c: string): string;
/**
* Lexers can normally match any char in it's vocabulary after matching
* a token, so do the easy thing and just kill a character and hope
* it all works out. You can instead use the rule invocation stack
* to do sophisticated error recovery if you are in a fragment rule.
*/
recover(re: RecognitionException): void;
set inputStream(input: InputStream);
get inputStream(): InputStream;
set type(type: number);
get type(): number;
set line(line: number);
get line(): number;
set column(column: number);
get column(): number;
set text(text: string);
get text(): string;
}