mike-lischke / vscode-antlr4

ANTLR4 language support for Visual Studio Code
http://www.soft-gems.net
MIT License
429 stars 60 forks source link

The parser and lexer generated are no more compatible with nuget antlr4.runtime.standard 4.10.x #172

Closed tcattel closed 1 year ago

tcattel commented 2 years ago

https://github.com/antlr/antlr4/releases 4.10-generated parsers incompatible with previous runtimes

meaning an update of this extension needs to be provided in order to be able to use nuget antlr4.runtime.standard 4.10.x otherwise stay with nuget antlr4.runtime.standard 4.9.x

mike-lischke commented 2 years ago

How's nuget involved here. Did you meant o file an issue against a Visual Studio extension?

FYI: because the TS runtime is not yet updated, I cannot use ANTLR 4.10 yet, but that's a different issue.

tcattel commented 2 years ago

if I install your current extension for Antlr4 for VSCode, create a .g4 and generate C# from there, I can use the nuget for Antlr4.10. They are not compatible breaking changes in the generated parser (see release notes of v4.10 of nuget for Antlr4)

So I suspect as soon as you are able to une ANTLR 4.10, this will be fixed.

mike-lischke commented 2 years ago

Aha, now I understand. And thinking about the issue it becomes clear that I can upgrade for all targets except TS, so this can be done with the next update.

mike-lischke commented 2 years ago

Actually, it's not that easy. The serialized ATN changed in 4.10, so I have to update the interpreter data reader for that. This switch will take a while to be done.

However, the extension has a custom jar setting, where you can specify 4.10, but this will print errors for internal functionality.

eseglem commented 2 years ago

If you point it at a 4.10+ jar, it will generate files. But then you end up getting a generic "Error: Debugger creation files. You are either trying to debug an unsupported file type or no interpreter data has been generated yet for the given grammar." Which isn't the most helpful. Only after going into the console and seeing "Error: Could not deserialize ATN with version 4 (expected 3)" did it lead me to here. If there isn't progress on the TS side, might be worth updating the docs / error messages around this.

TheBoz commented 1 year ago

I am getting the same Error: Could not deserialize ATN with version 4 (expected 3) using the Go target.

My go.mod has these settings: require github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20221202181307-76fa05c21b12 require golang.org/x/exp v0.0.0-20230213192124-5e25df0256eb // indirect

I am using antlr-4.11.1-complete.jar (latest).

The build and compile work fine but apparently the VS Code extension has not been upgraded to work with version 4?

mike-lischke commented 1 year ago

The extension is still expecting a 4.9 of ANTLR4. I'm working on a new Typescript runtime currently that will allow to use newer ANTLR4 versions.

mike-lischke commented 1 year ago

A new release (2.4.0) was just published, which now works with the latest ANTLR4 version.