antlr / antlr4-intellij-adaptor

A library to support the use of ANTLR grammars in jetbrains IDE plugins for building custom languages.
BSD 2-Clause "Simplified" License
212 stars 38 forks source link

Don't force use of deprecated API #23

Closed matozoid closed 1 year ago

matozoid commented 3 years ago

The latest ANTLR deprecates ...Parser.tokenNames. It is used in this project like so:

image

This PR changes that to use the suggested replacement instead:

image

Part of this change comes from https://github.com/kshchepanovskyi/antlr4-jetbrains-adapter/commit/48c4702725916bb0c8c84fdf0cdadae032651b2b

This breaks the API, but it is pretty obvious for a user how to fix it, in my opinion.

ziscloud commented 1 year ago

please review and merge this.

parrt commented 1 year ago

Ok, will this break the intellij plugin for antlr? Could you tweak that one too?

ziscloud commented 1 year ago

no, it does not break the plugin even with the latest antlr, but it is a positive fixing of this project anyway.

parrt commented 1 year ago

thanks!

matozoid commented 1 year ago

And thanks!

oovm commented 1 year ago

image

Why is my VOCABULARY not an array?

(antlr 4.12.0)

bjansen commented 1 year ago

@oovm the PR has been merged but the change has not been released yet, so in antlr4-intellij-adaptor 0.1 you still have to use something like:

PSIElementTypeFactory.defineLanguageIElementTypes(
        ANTLRv4Language.INSTANCE,
        ANTLRv4Lexer.tokenNames,
        ANTLRv4Parser.ruleNames
);