gumtree icon indicating copy to clipboard operation
gumtree copied to clipboard

use treesitter parse ast failed

Open yikengboy opened this issue 1 year ago • 4 comments

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

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?

yikengboy avatar May 30 '24 12:05 yikengboy

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

jrfaller avatar May 30 '24 19:05 jrfaller

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.

jrfaller avatar May 31 '24 06:05 jrfaller

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.

yikengboy avatar May 31 '24 09:05 yikengboy

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

jrfaller avatar Jun 05 '24 08:06 jrfaller