You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+31-2
Original file line number
Diff line number
Diff line change
@@ -49,8 +49,37 @@ In the example above, to fetch the JavaScript grammar, you can run the following
49
49
go get github.com/tree-sitter/tree-sitter-javascript@latest
50
50
```
51
51
52
-
Due to [bugs with `runtime.SetFinalizer` and CGO](https://groups.google.com/g/golang-nuts/c/LIWj6Gl--es), you must always call `Close`
53
-
on an object that allocates memory from C. This must be done for the `Parser`, `Tree`, `TreeCursor`, `Query`, `QueryCursor`, and `LookaheadIterator` objects.
52
+
Alternatively you can also load grammars at runtime from a shared library via [purego](https://github.com/ebitengine/purego).
53
+
54
+
The example below shows how to load the JavaScript grammar from a shared library (`libtree-sitter-PARSER_NAME.so`) at runtime on Linux & macOS:
55
+
56
+
For more information on other platforms, see the [purego documentation](https://github.com/ebitengine/purego#supported-platforms)
> Due to [bugs with `runtime.SetFinalizer` and CGO](https://groups.google.com/g/golang-nuts/c/LIWj6Gl--es), you must always call `Close`
82
+
> on an object that allocates memory from C. This must be done for the `Parser`, `Tree`, `TreeCursor`, `Query`, `QueryCursor`, and `LookaheadIterator` objects.
54
83
55
84
For more information, see the [documentation](https://pkg.go.dev/github.com/tree-sitter/go-tree-sitter).
0 commit comments