Skip to content

Commit c0cd12e

Browse files
Update to tree-sitter 0.23 (#70)
1 parent c7ae8b7 commit c0cd12e

File tree

19 files changed

+142
-52
lines changed

19 files changed

+142
-52
lines changed

Cargo.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "tree-sitter-elixir"
33
description = "Elixir grammar for the tree-sitter parsing library"
4-
version = "0.2.0"
4+
version = "0.3.0"
55
keywords = ["incremental", "parsing", "elixir"]
66
categories = ["parsing", "text-editors"]
77
repository = "https://github.com/elixir-lang/tree-sitter-elixir"
@@ -20,7 +20,10 @@ include = [
2020
path = "bindings/rust/lib.rs"
2121

2222
[dependencies]
23-
tree-sitter = ">=0.21.0"
23+
tree-sitter-language = "0.1.0"
24+
25+
[dev-dependencies]
26+
tree-sitter = "0.23.0"
2427

2528
[build-dependencies]
2629
cc = "1.0"

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION := 0.2.0
1+
VERSION := 0.3.0
22

33
# Repository
44
SRC_DIR := src

binding.gyp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"sources": [
1212
"bindings/node/binding.cc",
1313
"src/parser.c",
14-
# NOTE: if your language has an external scanner, add it here.
14+
"src/scanner.c",
1515
],
1616
"cflags_c": [
1717
"-std=c11",

bindings/go/binding.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package tree_sitter_elixir
22

33
// #cgo CFLAGS: -std=c11 -fPIC
44
// #include "../../src/parser.c"
5-
// // NOTE: if your language has an external scanner, add it here.
5+
// #include "../../src/scanner.c"
66
import "C"
77

88
import "unsafe"

bindings/go/binding_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package tree_sitter_elixir_test
33
import (
44
"testing"
55

6-
tree_sitter "github.com/smacker/go-tree-sitter"
7-
"github.com/tree-sitter/tree-sitter-elixir"
6+
tree_sitter "github.com/tree-sitter/go-tree-sitter"
7+
tree_sitter_elixir "github.com/tree-sitter/tree-sitter-elixir/bindings/go"
88
)
99

1010
func TestCanLoadGrammar(t *testing.T) {

bindings/go/go.mod

Lines changed: 0 additions & 5 deletions
This file was deleted.

bindings/node/binding_test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/// <reference types="node" />
2+
3+
const assert = require("node:assert");
4+
const { test } = require("node:test");
5+
6+
test("can load grammar", () => {
7+
const parser = new (require("tree-sitter"))();
8+
assert.doesNotThrow(() => parser.setLanguage(require(".")));
9+
});

bindings/python/tests/test_binding.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from unittest import TestCase
2+
3+
import tree_sitter, tree_sitter_elixir
4+
5+
6+
class TestLanguage(TestCase):
7+
def test_can_load_grammar(self):
8+
try:
9+
tree_sitter.Language(tree_sitter_elixir.language())
10+
except Exception:
11+
self.fail("Error loading Elixir grammar")

bindings/python/tree_sitter_elixir/binding.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ typedef struct TSLanguage TSLanguage;
44

55
TSLanguage *tree_sitter_elixir(void);
66

7-
static PyObject* _binding_language(PyObject *self, PyObject *args) {
8-
return PyLong_FromVoidPtr(tree_sitter_elixir());
7+
static PyObject* _binding_language(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(args)) {
8+
return PyCapsule_New(tree_sitter_elixir(), "tree_sitter.Language", NULL);
99
}
1010

1111
static PyMethodDef methods[] = {

bindings/rust/build.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ fn main() {
77
.flag_if_supported("-Wno-unused-parameter")
88
.flag_if_supported("-Wno-unused-but-set-variable")
99
.flag_if_supported("-Wno-trigraphs");
10+
#[cfg(target_env = "msvc")]
11+
c_config.flag("-utf-8");
12+
1013
let parser_path = src_dir.join("parser.c");
1114
c_config.file(&parser_path);
1215
println!("cargo:rerun-if-changed={}", parser_path.to_str().unwrap());

0 commit comments

Comments
 (0)