antlr / antlr/antlr4

setErrorHandler method is missing from Parser class in TypeScript target

Open
#4,633 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
19k
Forks
3.5k
PR merge metrics
No merged PRs in 30d

Description

I extended DefaultErrorStratergy class to customize the ANTLR error messages

The Java implementation (and the documentation for the BailErrorStrategy) suggest that such a method should exist.
![image](https://github.com/antlr/antlr4/assets/160007426/e912c180-76f2-4d83-aa95-d8b6272a9359)

After staring at the source, the only way I've found to change the error strategy is to modify the **_errHandler** field of the parser directly which is also not working as expected to customize the error messages

![image](https://github.com/antlr/antlr4/assets/160007426/c7223185-eef4-499e-8a34-b0183ea83f4e)

![image](https://github.com/antlr/antlr4/assets/160007426/8912d5ab-1f5b-41fd-8dd5-7c5825844fff)

Contributor guide

Open the contributing guide

Research direction

Start with the TypeScript target's Parser class and compare its error-handling API with the Java implementation and BailErrorStrategy documentation. Investigate how _errHandler is used and determine the expected public way to customize error messages; done means the missing method is available and custom error handling works as described.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, typescript
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.