netbeans icon indicating copy to clipboard operation
netbeans copied to clipboard

Make ANTLRv4 generated Lexer integration into NetBeans easy.

Open lkishalmi opened this issue 3 years ago • 1 comments

Well working on some ANTLRv4 stuff lately, for upcoming TOML support. Noticed that I need an implementations of CharStream over LexerInput and that, ANTLR Lexer is used as just convert some token type (that is an int in ANTRL4) to a TokenId

The second commit is a kind of demonstration of the usage of this new module. A candidate could be our CSS lexer, though that seems to be on ANTLRv3 at the moment. I would use this module on TOML support. (I'm working on something for Terraform (HCL) as well.) Maybe a reduced dumb grammar for Gradle DSL instead if our Groovy...

Also it might be good to try to move the ANTLRv3 stuff to ANTLRv4...

lkishalmi avatar Aug 07 '22 05:08 lkishalmi

In general I refrain from creating a library if there is no clear advantage. The problem with libraries and NetBeans "we never break API" attitude is, that you set thinks in stone, that you might regret. If the code is copied you pay by maybe doing work twice, but on the other hand you gain bigger freedoms. Not sure where I'd make the tradeoff, but two use sites seems not enough for the introduced dependency.

Also it might be good to try to move the ANTLRv3 stuff to ANTLRv4...

Any reason to do so? The dependencies of antlr are more or less trivial and it does not tie into the JVM, so I don't expect problems in the future.

matthiasblaesing avatar Aug 09 '22 20:08 matthiasblaesing

Well, I may was a bit too eager with this. Let's put this rest now.

lkishalmi avatar Aug 17 '22 02:08 lkishalmi

@matthiasblaesing I'm going to re-create this effort. I think I've learned a few things during the last few months. My current projects could benefit from this. Though the implementation would be different, containing the things I've learned on the road.

As of the API attitude, this would be so thin that you can always opt-out.

lkishalmi avatar Jan 04 '23 22:01 lkishalmi