From 78be3bf92ff06a422e5a376ab3e30f97fd0fcdc3 Mon Sep 17 00:00:00 2001 From: Mike Lischke Date: Sat, 2 Sep 2023 11:10:16 +0200 Subject: [PATCH] Fixed wrong type parameter for recognizers + error listeners. Signed-off-by: Mike Lischke --- runtime/JavaScript/src/antlr4/Lexer.d.ts | 3 +-- runtime/JavaScript/src/antlr4/Parser.d.ts | 5 ++--- runtime/JavaScript/src/antlr4/Recognizer.d.ts | 6 ++++-- .../JavaScript/src/antlr4/atn/LexerATNSimulator.d.ts | 6 +++--- .../src/antlr4/atn/PrecedencePredicate.d.ts | 6 +++--- runtime/JavaScript/src/antlr4/atn/Predicate.d.ts | 4 ++-- .../JavaScript/src/antlr4/atn/SemanticContext.d.ts | 4 ++-- .../src/antlr4/error/DiagnosticErrorListener.d.ts | 5 +++-- .../JavaScript/src/antlr4/error/ErrorListener.d.ts | 11 ++++++----- runtime/JavaScript/src/antlr4/tree/TerminalNode.d.ts | 4 ++-- 10 files changed, 28 insertions(+), 26 deletions(-) diff --git a/runtime/JavaScript/src/antlr4/Lexer.d.ts b/runtime/JavaScript/src/antlr4/Lexer.d.ts index 0e7f23c46e..86f2fdd227 100644 --- a/runtime/JavaScript/src/antlr4/Lexer.d.ts +++ b/runtime/JavaScript/src/antlr4/Lexer.d.ts @@ -10,13 +10,12 @@ import Token from "./Token.js"; import TokenSource from "./TokenSource.js"; import TokenFactory from "./TokenFactory.js"; -export declare abstract class Lexer extends Recognizer implements TokenSource { +export declare abstract class Lexer extends Recognizer implements TokenSource { public static DEFAULT_MODE: number; public static HIDDEN: number; public _input: CharStream; - public _interp: LexerATNSimulator; public text: string; public line: number; public column: number; diff --git a/runtime/JavaScript/src/antlr4/Parser.d.ts b/runtime/JavaScript/src/antlr4/Parser.d.ts index 0c2c833b97..3bd65ade9b 100644 --- a/runtime/JavaScript/src/antlr4/Parser.d.ts +++ b/runtime/JavaScript/src/antlr4/Parser.d.ts @@ -15,14 +15,13 @@ import IntervalSet from "./misc/IntervalSet.js"; import ParseTreeListener from "./tree/ParseTreeListener.js"; import Printer from "./utils/Printer.js"; -export declare abstract class Parser extends Recognizer { +export declare abstract class Parser extends Recognizer { public static EOF: number; - private _parseListeners: ParseTreeListener[] | null; + protected _parseListeners: ParseTreeListener[] | null; public _input: TokenStream; public _ctx: ParserRuleContext; - public _interp: ParserATNSimulator; public _errHandler: ErrorStrategy; public matchedEOF: boolean; public buildParseTrees: boolean; diff --git a/runtime/JavaScript/src/antlr4/Recognizer.d.ts b/runtime/JavaScript/src/antlr4/Recognizer.d.ts index 266bb0ece0..8bd49bf9fd 100644 --- a/runtime/JavaScript/src/antlr4/Recognizer.d.ts +++ b/runtime/JavaScript/src/antlr4/Recognizer.d.ts @@ -5,10 +5,12 @@ import Vocabulary from "./Vocabulary.js"; import ATN from "./atn/ATN.js"; +import ATNSimulator from "./atn/ATNSimulator.js"; import ErrorListener from "./error/ErrorListener.js"; -export declare abstract class Recognizer { +export declare abstract class Recognizer { public state: number; + public _interp: ATNInterpreter; public get atn(): ATN; @@ -17,7 +19,7 @@ export declare abstract class Recognizer { public abstract getVocabulary(): Vocabulary; public removeErrorListeners(): void; - public addErrorListener(listener: ErrorListener): void; + public addErrorListener(listener: ErrorListener): void; } export default Recognizer; diff --git a/runtime/JavaScript/src/antlr4/atn/LexerATNSimulator.d.ts b/runtime/JavaScript/src/antlr4/atn/LexerATNSimulator.d.ts index 0461f1d986..52434805ea 100644 --- a/runtime/JavaScript/src/antlr4/atn/LexerATNSimulator.d.ts +++ b/runtime/JavaScript/src/antlr4/atn/LexerATNSimulator.d.ts @@ -3,18 +3,18 @@ * can be found in the LICENSE.txt file in the project root. */ -import Recognizer from "../Recognizer.js"; import ATNSimulator from "./ATNSimulator.js"; import ATN from "./ATN.js"; import PredictionContextCache from "./PredictionContextCache.js"; import DFA from "../dfa/DFA.js"; import CharStream from "../CharStream.js"; +import Lexer from "../Lexer.js"; -export declare class LexerATNSimulator implements ATNSimulator { +export declare class LexerATNSimulator extends ATNSimulator { decisionToDFA: DFA[]; - constructor(recog: Recognizer, atn: ATN, decisionToDFA: DFA[], sharedContextCache: PredictionContextCache); + constructor(recog: Lexer, atn: ATN, decisionToDFA: DFA[], sharedContextCache: PredictionContextCache); consume(input: CharStream): void; } diff --git a/runtime/JavaScript/src/antlr4/atn/PrecedencePredicate.d.ts b/runtime/JavaScript/src/antlr4/atn/PrecedencePredicate.d.ts index 9c1017646f..90e5b898a5 100644 --- a/runtime/JavaScript/src/antlr4/atn/PrecedencePredicate.d.ts +++ b/runtime/JavaScript/src/antlr4/atn/PrecedencePredicate.d.ts @@ -3,7 +3,7 @@ * can be found in the LICENSE.txt file in the project root. */ -import Recognizer from "../Recognizer.js"; +import Parser from "../Parser.js"; import RuleContext from "../context/RuleContext.js"; import SemanticContext from "./SemanticContext.js"; @@ -12,8 +12,8 @@ export declare class PrecedencePredicate extends SemanticContext { public constructor(precedence?: number); - public evaluate(parser: Recognizer, parserCallStack: RuleContext): boolean; - public evalPrecedence(parser: Recognizer, parserCallStack: RuleContext): SemanticContext; + public evaluate(parser: Parser, parserCallStack: RuleContext): boolean; + public evalPrecedence(parser: Parser, parserCallStack: RuleContext): SemanticContext; public compareTo(o: PrecedencePredicate): number; public equals(other: unknown): boolean; diff --git a/runtime/JavaScript/src/antlr4/atn/Predicate.d.ts b/runtime/JavaScript/src/antlr4/atn/Predicate.d.ts index ed8701b886..e7bc23bd8a 100644 --- a/runtime/JavaScript/src/antlr4/atn/Predicate.d.ts +++ b/runtime/JavaScript/src/antlr4/atn/Predicate.d.ts @@ -3,14 +3,14 @@ * can be found in the LICENSE.txt file in the project root. */ -import Recognizer from "../Recognizer.js"; +import Parser from "../Parser.js"; import RuleContext from "../context/RuleContext.js"; import SemanticContext from "./SemanticContext.js"; export declare class Predicate extends SemanticContext { public constructor(ruleIndex: number, predIndex: number, isCtxDependent: boolean); - public evaluate(parser: Recognizer, outerContext: RuleContext): boolean; + public evaluate(parser: Parser, outerContext: RuleContext): boolean; public equals(obj: any): boolean; public toString(): string; } diff --git a/runtime/JavaScript/src/antlr4/atn/SemanticContext.d.ts b/runtime/JavaScript/src/antlr4/atn/SemanticContext.d.ts index 2b420947c4..1fb06df452 100644 --- a/runtime/JavaScript/src/antlr4/atn/SemanticContext.d.ts +++ b/runtime/JavaScript/src/antlr4/atn/SemanticContext.d.ts @@ -3,12 +3,12 @@ * can be found in the LICENSE.txt file in the project root. */ -import Recognizer from "../Recognizer.js"; +import Parser from "../Parser.js"; import RuleContext from "../context/RuleContext.js"; export declare class SemanticContext { public hashCode(): number; - public evaluate(parser: Recognizer, outerContext: RuleContext): boolean; + public evaluate(parser: Parser, outerContext: RuleContext): boolean; } export default SemanticContext; diff --git a/runtime/JavaScript/src/antlr4/error/DiagnosticErrorListener.d.ts b/runtime/JavaScript/src/antlr4/error/DiagnosticErrorListener.d.ts index 3f57bc91bc..1d174af7b1 100644 --- a/runtime/JavaScript/src/antlr4/error/DiagnosticErrorListener.d.ts +++ b/runtime/JavaScript/src/antlr4/error/DiagnosticErrorListener.d.ts @@ -6,9 +6,10 @@ import ErrorListener from "./ErrorListener"; import Recognizer from "../Recognizer"; import RecognitionException from "./RecognitionException"; +import ATNSimulator from "../atn/ATNSimulator"; -export declare class DiagnosticErrorListener extends ErrorListener { - syntaxError(recognizer: Recognizer, offendingSymbol: TSymbol, line: number, column: number, msg: string, e: RecognitionException | undefined): void; +export declare class DiagnosticErrorListener extends ErrorListener { + syntaxError(recognizer: Recognizer, offendingSymbol: T, line: number, column: number, msg: string, e: RecognitionException | undefined): void; } export default DiagnosticErrorListener; diff --git a/runtime/JavaScript/src/antlr4/error/ErrorListener.d.ts b/runtime/JavaScript/src/antlr4/error/ErrorListener.d.ts index 8788237fd5..5971982c3f 100644 --- a/runtime/JavaScript/src/antlr4/error/ErrorListener.d.ts +++ b/runtime/JavaScript/src/antlr4/error/ErrorListener.d.ts @@ -5,14 +5,15 @@ import Recognizer from "../Recognizer.js"; import ATNConfigSet from "../atn/ATNConfigSet.js"; +import ATNSimulator from "../atn/ATNSimulator.js"; import DFA from "../dfa/DFA.js"; import RecognitionException from "./RecognitionException.js"; -export declare class ErrorListener { - public syntaxError(recognizer: Recognizer, offendingSymbol: TSymbol, line: number, column: number, msg: string, e: RecognitionException | undefined): void; - public reportAmbiguity(recognizer: Recognizer, dfa: DFA, startIndex: number, stopIndex: number, exact: boolean, ambigAlts: unknown, configs: ATNConfigSet): void; - public reportAttemptingFullContext(recognizer: Recognizer, dfa: DFA, startIndex: number, stopIndex: number, conflictingAlts: unknown, configs: ATNConfigSet): void; - public reportContextSensitivity(recognizer: Recognizer, dfa: DFA, startIndex: number, stopIndex: number, prediction: number, configs: ATNConfigSet): void; +export declare class ErrorListener { + public syntaxError(recognizer: Recognizer, offendingSymbol: T, line: number, column: number, msg: string, e: RecognitionException | undefined): void; + public reportAmbiguity(recognizer: Recognizer, dfa: DFA, startIndex: number, stopIndex: number, exact: boolean, ambigAlts: unknown, configs: ATNConfigSet): void; + public reportAttemptingFullContext(recognizer: Recognizer, dfa: DFA, startIndex: number, stopIndex: number, conflictingAlts: unknown, configs: ATNConfigSet): void; + public reportContextSensitivity(recognizer: Recognizer, dfa: DFA, startIndex: number, stopIndex: number, prediction: number, configs: ATNConfigSet): void; } export default ErrorListener; diff --git a/runtime/JavaScript/src/antlr4/tree/TerminalNode.d.ts b/runtime/JavaScript/src/antlr4/tree/TerminalNode.d.ts index b0b3a37d45..12adce9de7 100644 --- a/runtime/JavaScript/src/antlr4/tree/TerminalNode.d.ts +++ b/runtime/JavaScript/src/antlr4/tree/TerminalNode.d.ts @@ -7,7 +7,7 @@ import ParserRuleContext from "../context/ParserRuleContext.js"; import ParseTree from "./ParseTree.js"; import Token from "../Token.js"; import Interval from "../misc/Interval.js"; -import Recognizer from "../Recognizer.js"; +import Parser from "../Parser.js"; export declare class TerminalNode extends ParseTree { public symbol: Token; @@ -20,7 +20,7 @@ export declare class TerminalNode extends ParseTree { public getPayload(): Token; public getSourceInterval(): Interval; public getChildCount(): number; - public toStringTree(parser: Recognizer | null): string; + public toStringTree(parser: Parser | null): string; public toString(): string; public toStringTree(): string;