Skip to content

Commit

Permalink
feat: use errorhandler form params
Browse files Browse the repository at this point in the history
  • Loading branch information
HaydenOrz committed Oct 16, 2023
1 parent 62ea98f commit 3f0c96c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/parser/common/basicParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,10 @@ export default abstract class BasicParser<
protected _parser: P;
protected _parseTree: PRC;
protected _parsedInput: string = null;
protected _parseErrors: ParseError[];
protected _parseErrors: ParseError[] = [];
/** members for cache end */

private _errorHandler: ErrorHandler<any> = (error) => {
debugger;
this._parseErrors.push(error);
};

Expand Down Expand Up @@ -97,7 +96,7 @@ export default abstract class BasicParser<
const lexer = this.createLexerFormCharStream(charStreams);
if(errorListener) {
lexer.removeErrorListeners();
lexer.addErrorListener(new ParseErrorListener(this._errorHandler));
lexer.addErrorListener(new ParseErrorListener(errorListener));
}
return lexer;
}
Expand All @@ -113,7 +112,7 @@ export default abstract class BasicParser<

if(errorListener) {
parser.removeErrorListeners();
parser.addErrorListener(new ParseErrorListener(this._errorHandler));
parser.addErrorListener(new ParseErrorListener(errorListener));
}

return parser;
Expand Down

0 comments on commit 3f0c96c

Please sign in to comment.