Skip to content

Conversation

svanteschubert
Copy link

This patch is NOT meant to be ready4integration, but as an assistance to finish the integration of ANTLR4 to GumTree.

The added Java code is based on the ANTLR4 related pull request for PHP by Mikulas
#47

I exchanged the PHP grammar with the reference XML grammar from the book
https://pragprog.com/book/tpantlr2/the-definitive-antlr-4-reference
which can be found under
https://github.com/antlr/grammars-v4/tree/master/xml
to have no doubt on the ANTLR side.
The only thing altered on the above XML ANTLR4 grammars are the GumTree package names.

What is in addition working for ANTLR in this patch (and took me hours of config combinations) is to compile the two distinct lexer and parser grammar with Gradle.

As glue between ANTLR4 Java files and GumTree I used the tree generators of Mikulas, which is unfortunately not working correctly and my knowledge of GumTree is too low to do a good job here in reasonable time. Therefore I would like to ask for some assistance.

In addition, I suggest adding to all new ANTLR grammars some mandatory regression tests (proof of concept) directly to the ANTLR4 grammar module.
The initial test attached to this patch tries to diff two XML files from the book and fails with the adopted code from Mikulas.
A final adjustment of the test would have to be done when the exact test result is known from a running application.

PS: Note: I started with JSON but I would rather do a joint of the existing GumTree grammar
https://github.com/GumTreeDiff/gumtree/blob/develop/gen.antlr3-json/src/main/antlr/com/github/gumtreediff/gen/antlr3/json/JSON.g
(which seems erroneous as a '+' is missing for exponents, but more readable)
and the one beyond
https://github.com/antlr/grammars-v4/tree/master/json
Therefore I used XML instead, as the grammar was taken as an example in the book and therefore well reviewed and tested.

Thanks in advance for your help,
Svante

@svanteschubert
Copy link
Author

Starting a new pull request with working ANTLR4 support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant