Skip to content

Commit

Permalink
fix(JS: ErrorListener types) (#4731)
Browse files Browse the repository at this point in the history
* fix(JS: ErrorListener types)

Signed-off-by: Francisco Rodriguez Elorza <[email protected]>

* update DiagnosticErrorListener type

Signed-off-by: Francisco Rodriguez Elorza <[email protected]>

* Remove write methos on BitSet

Signed-off-by: Francisco Rodriguez Elorza <[email protected]>

---------

Signed-off-by: Francisco Rodriguez Elorza <[email protected]>
Co-authored-by: Francisco Rodriguez Elorza <[email protected]>
  • Loading branch information
elorzafe and Francisco Rodriguez Elorza authored Nov 22, 2024
1 parent 2c5cc31 commit 6722835
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
import {ErrorListener} from "./ErrorListener";
import {Recognizer} from "../Recognizer";
import {RecognitionException} from "./RecognitionException";

export declare class DiagnosticErrorListener<TSymbol> implements ErrorListener<TSymbol> {

syntaxError(recognizer: Recognizer<TSymbol>, offendingSymbol: TSymbol, line: number, column: number, msg: string, e: RecognitionException | undefined): void;

}
export declare class DiagnosticErrorListener<TSymbol> extends ErrorListener<TSymbol> {}
13 changes: 11 additions & 2 deletions runtime/JavaScript/src/antlr4/error/ErrorListener.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
import {Recognizer} from "../Recognizer";
import {RecognitionException} from "./RecognitionException";
import { ATNConfigSet } from "../atn";
import { BitSet } from '../misc/BitSet';
import { DFA } from "../dfa";
import { Recognizer } from "../Recognizer";
import { RecognitionException } from "./RecognitionException";

export declare class ErrorListener<TSymbol> {
reportAmbiguity(recognizer: Recognizer<TSymbol>, dfa: DFA, startIndex: number, stopIndex: number, exact: boolean, ambigAlts: BitSet, configs: ATNConfigSet): void;

reportAttemptingFullContext(recognizer: Recognizer<TSymbol>, dfa: DFA, startIndex: number, stopIndex: number, conflictingAlts: BitSet, configs: ATNConfigSet): void;

reportContextSensitivity(recognizer: Recognizer<TSymbol>, dfa: DFA, startIndex: number, stopIndex: number, prediction: number, configs: ATNConfigSet): void;

syntaxError(recognizer: Recognizer<TSymbol>, offendingSymbol: TSymbol, line: number, column: number, msg: string, e: RecognitionException | undefined): void;
}
18 changes: 18 additions & 0 deletions runtime/JavaScript/src/antlr4/misc/BitSet.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export declare class BitSet {
// write methods are not exposed based on this conversation https://github.com/antlr/antlr4/pull/4731#discussion_r1847139040
readonly length: number;

get(index: number): number;

values(): Array<number>;

minValue(): number;

hashCode(): number;

equals(): boolean;

toString(): string;

static _bitCount(l: number): number;
}

0 comments on commit 6722835

Please sign in to comment.