antlr4 icon indicating copy to clipboard operation
antlr4 copied to clipboard

Report LexerEmptyModeStackException instead of throwing empty stack exception

Open KvanTTT opened this issue 4 years ago • 4 comments

fixes #2006

Fixed for Java, C#, Python2/3, JavaScript, Go runtimes Need to be fixed: C++, Swift, Dart, PHP

KvanTTT avatar Oct 25 '21 18:10 KvanTTT

@parrt could you review this draft? If you agree with it, I'll complete other runtimes soon (C++, Swift, Dart, PHP).

KvanTTT avatar Oct 28 '21 18:10 KvanTTT

at first glance this seems reasonable, but I'm always hesitant to add another class. Of course this is only an exception class so not a huge technical burden/debt. @ericvergnaud does this look ok? I definitely think it should avoid crashing for this error.

parrt avatar Oct 28 '21 19:10 parrt

Hi,

I don’t disagree with the proposed change, but given the scope I suggest we postpone it to the next release. This will buy us time to calmly and collectively assess the impact.

Eric

Le 29 oct. 2021 à 01:34, Ivan Kochurkin @.***> a écrit :

@KvanTTT commented on this pull request.

In runtime/CSharp/src/Lexer.cs https://github.com/antlr/antlr4/pull/3317#discussion_r738841798:

@@ -553,12 +556,13 @@ public virtual void Recover(LexerNoViableAltException e) } }

  •    public virtual void NotifyListeners(LexerNoViableAltException e)
    

But it's not possible for dynamic languages (Python, Javascript), since they don't support method overloading.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/antlr/antlr4/pull/3317#discussion_r738841798, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZNQJCXZLITM3JMZBBBS5DUJHMZ3ANCNFSM5GV6NNDA.

ericvergnaud avatar Oct 29 '21 08:10 ericvergnaud

Ok, let's postpone this bug fix until the next release.

KvanTTT avatar Oct 29 '21 10:10 KvanTTT