aboutsummaryrefslogtreecommitdiff
path: root/bindings/go
diff options
context:
space:
mode:
Diffstat (limited to 'bindings/go')
-rw-r--r--bindings/go/binding.go15
-rw-r--r--bindings/go/binding_test.go15
2 files changed, 30 insertions, 0 deletions
diff --git a/bindings/go/binding.go b/bindings/go/binding.go
new file mode 100644
index 0000000..80fe78d
--- /dev/null
+++ b/bindings/go/binding.go
@@ -0,0 +1,15 @@
+package tree_sitter_wmap
+
+// #cgo CFLAGS: -std=c11 -fPIC
+// #include "../../src/parser.c"
+// #if __has_include("../../src/scanner.c")
+// #include "../../src/scanner.c"
+// #endif
+import "C"
+
+import "unsafe"
+
+// Get the tree-sitter Language for this grammar.
+func Language() unsafe.Pointer {
+ return unsafe.Pointer(C.tree_sitter_wmap())
+}
diff --git a/bindings/go/binding_test.go b/bindings/go/binding_test.go
new file mode 100644
index 0000000..911fd9b
--- /dev/null
+++ b/bindings/go/binding_test.go
@@ -0,0 +1,15 @@
+package tree_sitter_wmap_test
+
+import (
+ "testing"
+
+ tree_sitter "github.com/tree-sitter/go-tree-sitter"
+ tree_sitter_wmap "git.sr.ht/~rbdr/tree-sitter-wmap/bindings/go"
+)
+
+func TestCanLoadGrammar(t *testing.T) {
+ language := tree_sitter.NewLanguage(tree_sitter_wmap.Language())
+ if language == nil {
+ t.Errorf("Error loading Wmap grammar")
+ }
+}