GumTreeDiff / gumtree

An awesome code differencing tool
https://github.com/GumTreeDiff/gumtree/wiki
GNU Lesser General Public License v3.0
933 stars 174 forks source link

use treesitter parse ast failed #354

Closed yikengboy closed 1 month ago

yikengboy commented 5 months ago

maven dependency `

com.github.gumtreediff
        <artifactId>gen.treesitter</artifactId>
        <version>4.0.0-beta2</version>

`

this is code: Run.initGenerators(); String srcFile = "/Users/haoyu/Downloads/java17-gumtree/a.java"; String dstFile = "/Users/haoyu/Downloads/java17-gumtree/c.java"; Tree src = TreeGenerators.getInstance().getTree(srcFile).getRoot(); Tree dst = TreeGenerators.getInstance().getTree(dstFile).getRoot(); Matcher defaultMatcher = Matchers.getInstance().getMatcher(); MappingStore mappings = defaultMatcher.match(src, dst); EditScriptGenerator editScriptGenerator = new SimplifiedChawatheScriptGenerator(); EditScript editScript = editScriptGenerator.computeActions(mappings); // computes the edit script Prompt error after execution Cannot run program "tree-sitter-parser.py" (in directory "/var/folders/c8/lxxw4ffd28nb0s0d4nbwpn_m0000gn/T"): error=2, No such file or directory I find project wiki don not find solution, can provide a solution?

jrfaller commented 5 months ago

I think that the external tree sitter parser python script is not installed correctly! Cheers.

jrfaller commented 5 months ago

Sure! Here: https://github.com/GumTreeDiff/tree-sitter-parser

Normally, since GumTree 4.0.0-beta3 there are the new gen.treesitter-ng bindings that allow using tree-sitter without our python parser (however no documentation on it at the moment).

Cheers.

yikengboy commented 5 months ago

Thanks, I install tree-sitter-javascript and tree-sitter-typescript. parse javascript is normal, can output xml normally result, But parsing typescript will prompt symbol not found error This is error stack image I'm not sure what other preparations need to be made.

jrfaller commented 5 months ago

Sorry I do not reproduce the bug. Can you detail the installation steps?