Skip to content

Conversation

@lkishalmi
Copy link
Contributor

This is my last round of features for ANTLR support, mainly for v4 grammars. Add indent support in rule definitions, and a few code shortcuts.

Beside of that, prevented a few of NPE-s that could happen on parsing an incomplete grammar. Also removed the ConsoleErrorListener.

@lkishalmi lkishalmi added this to the NB16 milestone Oct 16, 2022
Copy link
Member

@mbien mbien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good as far as I can tell. But I didn't "think through" the formatting code. Its been a while since I wrote an Antlr grammar.

This is also fairly low risk for inclusion. +1 for merging this before feature freeze.

@lkishalmi
Copy link
Contributor Author

Well, a formatter code is never nice, as far as I checked. The basic idea here is using a heuristic based on the Lexer to determine whether we are in a rule or not. While in rule, the whitespace is examined for each line break, and indent the line according to the inrule state.

@lkishalmi lkishalmi merged commit abb1a97 into apache:master Oct 17, 2022
Chris2011 pushed a commit to Chris2011/netbeans that referenced this pull request Dec 15, 2022
* Add indenting support for ANTLRv4 grammars

* Removed console error listeners, fixed a couple of potential NPE-s

* Added code snippets for ANTLR v4 Grammars

* ANTLR indent set to 4 be default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants