tree-sitter-groovy
raw JSON → 0.1.2 verified Sat May 09 auth: no python
Groovy grammar for tree-sitter, version 0.1.2. Provides a parser and syntax tree for Groovy files. Low release cadence; mature grammar.
pip install tree-sitter-groovy Common errors
error ModuleNotFoundError: No module named 'tree_sitter_groovy' ↓
cause tree-sitter-groovy not installed or installed in a different environment.
fix
Run
pip install tree-sitter-groovy in the correct environment. error TypeError: language() takes 0 positional arguments but 1 was given ↓
cause Passing arguments to `language()` which is no longer supported.
fix
Call
language() with no arguments; it returns the language object directly. Warnings
gotcha The grammar is incomplete and may fail on complex Groovy constructs. ↓
fix Test thoroughly; consider contributing to grammar improvements.
deprecated The old API of directly calling `language` without importing from the specific package is deprecated. ↓
fix Use `from tree_sitter_groovy import language` instead of `import tree_sitter_groovy; tree_sitter_groovy.language()`.
Imports
- language wrong
import tree_sitter_groovy; tree_sitter_groovy.language()correctfrom tree_sitter_groovy import language
Quickstart
from tree_sitter import Language, Parser
from tree_sitter_groovy import language
Lang = Language(language())
parser = Parser()
parser.set_language(Lang)
tree = parser.parse(b'println "hello"')
root = tree.root_node
print(root.sexp())