Open MariusKochFHDW opened 5 months ago
Hi! Can you find the parser you want here : https://github.com/bonede/tree-sitter-ng ? Cheers.
No, unfortunatly there isn't any supported parser for this programming language.
Is there any tree-sitter parser you know that might do the trick ?
I dont see any. Is there another trick i can use to integrate it?
so maybe you try the antlr-4 integration but I have never really used it seriously
Where can i find it?
We have a helper here -> https://github.com/GumTreeDiff/gumtree/blob/main/gen.antlr4/src/main/java/com/github/gumtreediff/gen/antlr4/AbstractAntlr4TreeGenerator.java But I have no sample project to showcase how to use it 😢
Thank you for the response :) I will have a look at it and tell you if it works.
Hoping for the best 😄
Maybe look at how we do for antlr 3 projects like this -> https://github.com/GumTreeDiff/gumtree/tree/main/gen.antlr3-r
Hey there again!
I just tried a bunch of stuff and came to the conclusion that the best/easiest way for me to implement PLSQL into Gumtree is the following:
Is there some kind of Method or API call that does the trick? Im pretty new to coding so i hope i didnt overlooked anything importent. Thankss :)
Hi! Normally if you have a antlr4 grammar you should be able to skip the XML part and use directly the antlr generated objects to convert them to a GumTree AST it would be much more efficient?
Hello again,
i just cant find any way to get it running.
FYI:
I'm producing a AST in python for PLSQL with a grammar i had to optimize a little bit. I tried to run the python script within the gumtree webdiff -x build_tree.py build_tree2.py
.
I gave it another shot with trying to use the -... g antlr-antlr example.pkh
. It starts the server but there isn't any diff that happend.
Can you give me a detailed explaination how to use the convert the generated objects to GumTree ASTs and then have a detailed Diff for them? Thank you in advance :))
Hi! Once you have converted your parser specific format to GumTree's agnostic format (a Tree
and a TreeContext
) every other things come for free (such as the diff :D). For antlr3
grammars it is done via subclassing our helper class like here : https://github.com/GumTreeDiff/gumtree/blob/main/gen.antlr3-r/src/main/java/com/github/gumtreediff/gen/antlr3/r/RTreeGenerator.java . I have no such example for antlr4 grammars but as far as I can see you have 3 methods to override here https://github.com/GumTreeDiff/gumtree/blob/main/gen.antlr4/src/main/java/com/github/gumtreediff/gen/antlr4/AbstractAntlr4TreeGenerator.java (and also don't forget to add the annotation to register the parser, as done in the antlr3 example). For the webdiff command it's trickier because you have to include the antlr4 projects in the distribution here : https://github.com/GumTreeDiff/gumtree/blob/main/dist/build.gradle . Sorry this a lot of stuff to do 😢
Hey man, almost everything done! I created a antlr3 folder and put an old grammar in there and registered everything. It works just like i hoped. The only issue is, that for bigger files (200KB+) the hilighting is getting offset to the text it's marking :( Is there any way to fix it? Otherwise it's something we can live with :)
Thank you a lot for your help Cheers!
Hi! Very good news! It's strange that you have offsetting problems I think it might come from the parser or the helper. It requires some debugging to understand why the position is wrong (fairly easy to do with a breakpoint if you know the grammar well). Cheers!
Hey there,
i was just set on a new Project to find a difftool for PLSQL and i recently found gumtree. I already have the antlr4 grammar and parser for PLSQL and have a python script to generate an AST. I already seen the tree-sitter but can't really figure out how to do it.
Thank you in advance :)