Open hudara opened 1 year ago
I am trying to create a Java parser which parse Javascript files. Here is what I have done:
- Build libjava-tree-sitter.dylib file
- Created a simple java command line application
- Tried to execute the following code:
try (Parser parser = new Parser()) { parser.setLanguage(Languages.javascript()); try (Tree tree = parser.parseString("function foo(){return 8;}")) { Node root = tree.getRootNode(); Node function = root.getChild(0); } catch (Exception e){ System.out.println("Error: " + e.getMessage()); e.printStackTrace(); } } }
The problem is that the returned "tree" object contains pointer "0" (zero) - I guess this is equivalent to "null" Executing the next line (tree.getRootNode) throws an exception:
My questions are:
- Any idea what can go wrong?
- How can I debug the code in the parser level?
# C [libjava-tree-sitter.dylib+0x292d4] ts_tree_root_node+0x0 # # No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again # Disconnected from the target VM, address: '127.0.0.1:57533', transport: 'socket' # An error report file with more information is saved as: # ********/tree-sitter/test-tree-sitter/hs_err_pid41900.log # # If you would like to submit a bug report, please visit: # https://github.com/Homebrew/homebrew-core/issues # The crash happened outside the Java Virtual Machine in native code. # See problematic frame for where to report the bug. # Process finished with exit code 134 (interrupted by signal 6: SIGABRT)
OS: MacOS 13.3.1
I am trying to create a Java parser which parse Javascript files. Here is what I have done:
Tried to execute the following code:
The problem is that the returned "tree" object contains pointer "0" (zero) - I guess this is equivalent to "null" Executing the next line (tree.getRootNode) throws an exception:
My questions are:
OS: MacOS 13.3.1