mirror of
https://github.com/kristoferssolo/tree-sitter-bruno.git
synced 2026-03-22 00:36:24 +00:00
chore: update packages
This commit is contained in:
1
bindings/c/tree-sitter-bruno.pc.in
generated
1
bindings/c/tree-sitter-bruno.pc.in
generated
@@ -6,6 +6,5 @@ Name: tree-sitter-bruno
|
||||
Description: @PROJECT_DESCRIPTION@
|
||||
URL: @PROJECT_HOMEPAGE_URL@
|
||||
Version: @PROJECT_VERSION@
|
||||
Requires: @TS_REQUIRES@
|
||||
Libs: -L${libdir} -ltree-sitter-bruno
|
||||
Cflags: -I${includedir}
|
||||
|
||||
2
bindings/go/binding.go
generated
2
bindings/go/binding.go
generated
@@ -2,7 +2,9 @@ package tree_sitter_bruno
|
||||
|
||||
// #cgo CFLAGS: -std=c11 -fPIC
|
||||
// #include "../../src/parser.c"
|
||||
// #if __has_include("../../src/scanner.c")
|
||||
// #include "../../src/scanner.c"
|
||||
// #endif
|
||||
import "C"
|
||||
|
||||
import "unsafe"
|
||||
|
||||
2
bindings/go/binding_test.go
generated
2
bindings/go/binding_test.go
generated
@@ -4,7 +4,7 @@ import (
|
||||
"testing"
|
||||
|
||||
tree_sitter "github.com/tree-sitter/go-tree-sitter"
|
||||
tree_sitter_bruno "github.com/kristoferssolo/tree-sitter-bruno/bindings/go"
|
||||
tree_sitter_bruno "codeberg.org/kristoferssolo/tree-sitter-bruno/bindings/go"
|
||||
)
|
||||
|
||||
func TestCanLoadGrammar(t *testing.T) {
|
||||
|
||||
1
bindings/node/binding.cc
generated
1
bindings/node/binding.cc
generated
@@ -10,7 +10,6 @@ const napi_type_tag LANGUAGE_TYPE_TAG = {
|
||||
};
|
||||
|
||||
Napi::Object Init(Napi::Env env, Napi::Object exports) {
|
||||
exports["name"] = Napi::String::New(env, "bruno");
|
||||
auto language = Napi::External<TSLanguage>::New(env, tree_sitter_bruno());
|
||||
language.TypeTag(&LANGUAGE_TYPE_TAG);
|
||||
exports["language"] = language;
|
||||
|
||||
6
bindings/node/binding_test.js
generated
6
bindings/node/binding_test.js
generated
@@ -1,9 +1,9 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
const assert = require("node:assert");
|
||||
const { test } = require("node:test");
|
||||
|
||||
const Parser = require("tree-sitter");
|
||||
|
||||
test("can load grammar", () => {
|
||||
const parser = new (require("tree-sitter"))();
|
||||
const parser = new Parser();
|
||||
assert.doesNotThrow(() => parser.setLanguage(require(".")));
|
||||
});
|
||||
|
||||
1
bindings/node/index.d.ts
generated
vendored
1
bindings/node/index.d.ts
generated
vendored
@@ -19,7 +19,6 @@ type NodeInfo =
|
||||
});
|
||||
|
||||
type Language = {
|
||||
name: string;
|
||||
language: unknown;
|
||||
nodeTypeInfo: NodeInfo[];
|
||||
};
|
||||
|
||||
6
bindings/node/index.js
generated
6
bindings/node/index.js
generated
@@ -1,6 +1,10 @@
|
||||
const root = require("path").join(__dirname, "..", "..");
|
||||
|
||||
module.exports = require("node-gyp-build")(root);
|
||||
module.exports =
|
||||
typeof process.versions.bun === "string"
|
||||
// Support `bun build --compile` by being statically analyzable enough to find the .node file at build-time
|
||||
? require(`../../prebuilds/${process.platform}-${process.arch}/tree-sitter-bruno.node`)
|
||||
: require("node-gyp-build")(root);
|
||||
|
||||
try {
|
||||
module.exports.nodeTypeInfo = require("../../src/node-types.json");
|
||||
|
||||
5
bindings/python/tests/test_binding.py
generated
5
bindings/python/tests/test_binding.py
generated
@@ -1,13 +1,12 @@
|
||||
from unittest import TestCase
|
||||
|
||||
from tree_sitter import Language, Parser
|
||||
import tree_sitter_bruno
|
||||
|
||||
import tree_sitter
|
||||
|
||||
|
||||
class TestLanguage(TestCase):
|
||||
def test_can_load_grammar(self):
|
||||
try:
|
||||
tree_sitter.Language(tree_sitter_bruno.language())
|
||||
Parser(Language(tree_sitter_bruno.language()))
|
||||
except Exception:
|
||||
self.fail("Error loading Bruno grammar")
|
||||
|
||||
33
bindings/python/tree_sitter_bruno/__init__.py
generated
33
bindings/python/tree_sitter_bruno/__init__.py
generated
@@ -6,7 +6,7 @@ from ._binding import language
|
||||
|
||||
|
||||
def _get_query(name, file):
|
||||
query = _files(f"{__package__}.queries") / "bruno" / file
|
||||
query = _files(f"{__package__}.queries") / file
|
||||
globals()[name] = query.read_text()
|
||||
return globals()[name]
|
||||
|
||||
@@ -14,14 +14,14 @@ def _get_query(name, file):
|
||||
def __getattr__(name):
|
||||
# NOTE: uncomment these to include any queries that this grammar contains:
|
||||
|
||||
if name == "HIGHLIGHTS_QUERY":
|
||||
return _get_query("HIGHLIGHTS_QUERY", "highlights.scm")
|
||||
if name == "INJECTIONS_QUERY":
|
||||
return _get_query("INJECTIONS_QUERY", "injections.scm")
|
||||
# if name == "HIGHLIGHTS_QUERY":
|
||||
# return _get_query("HIGHLIGHTS_QUERY", "highlights.scm")
|
||||
# if name == "INJECTIONS_QUERY":
|
||||
# return _get_query("INJECTIONS_QUERY", "injections.scm")
|
||||
# if name == "LOCALS_QUERY":
|
||||
# return _get_query("LOCALS_QUERY", "locals.scm")
|
||||
if name == "TAGS_QUERY":
|
||||
return _get_query("TAGS_QUERY", "tags.scm")
|
||||
# if name == "TAGS_QUERY":
|
||||
# return _get_query("TAGS_QUERY", "tags.scm")
|
||||
|
||||
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
||||
|
||||
@@ -36,18 +36,7 @@ __all__ = [
|
||||
|
||||
|
||||
def __dir__():
|
||||
return sorted(
|
||||
__all__
|
||||
+ [
|
||||
"__all__",
|
||||
"__builtins__",
|
||||
"__cached__",
|
||||
"__doc__",
|
||||
"__file__",
|
||||
"__loader__",
|
||||
"__name__",
|
||||
"__package__",
|
||||
"__path__",
|
||||
"__spec__",
|
||||
]
|
||||
)
|
||||
return sorted(__all__ + [
|
||||
"__all__", "__builtins__", "__cached__", "__doc__", "__file__",
|
||||
"__loader__", "__name__", "__package__", "__path__", "__spec__",
|
||||
])
|
||||
|
||||
6
bindings/python/tree_sitter_bruno/__init__.pyi
generated
6
bindings/python/tree_sitter_bruno/__init__.pyi
generated
@@ -2,9 +2,9 @@ from typing import Final
|
||||
|
||||
# NOTE: uncomment these to include any queries that this grammar contains:
|
||||
|
||||
HIGHLIGHTS_QUERY: Final[str]
|
||||
INJECTIONS_QUERY: Final[str]
|
||||
# HIGHLIGHTS_QUERY: Final[str]
|
||||
# INJECTIONS_QUERY: Final[str]
|
||||
# LOCALS_QUERY: Final[str]
|
||||
TAGS_QUERY: Final[str]
|
||||
# TAGS_QUERY: Final[str]
|
||||
|
||||
def language() -> object: ...
|
||||
|
||||
14
bindings/python/tree_sitter_bruno/binding.c
generated
14
bindings/python/tree_sitter_bruno/binding.c
generated
@@ -8,6 +8,13 @@ static PyObject* _binding_language(PyObject *Py_UNUSED(self), PyObject *Py_UNUSE
|
||||
return PyCapsule_New(tree_sitter_bruno(), "tree_sitter.Language", NULL);
|
||||
}
|
||||
|
||||
static struct PyModuleDef_Slot slots[] = {
|
||||
#ifdef Py_GIL_DISABLED
|
||||
{Py_mod_gil, Py_MOD_GIL_NOT_USED},
|
||||
#endif
|
||||
{0, NULL}
|
||||
};
|
||||
|
||||
static PyMethodDef methods[] = {
|
||||
{"language", _binding_language, METH_NOARGS,
|
||||
"Get the tree-sitter language for this grammar."},
|
||||
@@ -18,10 +25,11 @@ static struct PyModuleDef module = {
|
||||
.m_base = PyModuleDef_HEAD_INIT,
|
||||
.m_name = "_binding",
|
||||
.m_doc = NULL,
|
||||
.m_size = -1,
|
||||
.m_methods = methods
|
||||
.m_size = 0,
|
||||
.m_methods = methods,
|
||||
.m_slots = slots,
|
||||
};
|
||||
|
||||
PyMODINIT_FUNC PyInit__binding(void) {
|
||||
return PyModule_Create(&module);
|
||||
return PyModuleDef_Init(&module);
|
||||
}
|
||||
|
||||
6
bindings/rust/build.rs
generated
6
bindings/rust/build.rs
generated
@@ -12,8 +12,10 @@ fn main() {
|
||||
println!("cargo:rerun-if-changed={}", parser_path.to_str().unwrap());
|
||||
|
||||
let scanner_path = src_dir.join("scanner.c");
|
||||
c_config.file(&scanner_path);
|
||||
println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap());
|
||||
if scanner_path.exists() {
|
||||
c_config.file(&scanner_path);
|
||||
println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap());
|
||||
}
|
||||
|
||||
c_config.compile("tree-sitter-bruno");
|
||||
}
|
||||
|
||||
24
bindings/rust/lib.rs
generated
24
bindings/rust/lib.rs
generated
@@ -1,7 +1,7 @@
|
||||
//! This crate provides Bruno language support for the [tree-sitter][] parsing library.
|
||||
//! This crate provides Bruno language support for the [tree-sitter] parsing library.
|
||||
//!
|
||||
//! Typically, you will use the [LANGUAGE][] constant to add this language to a
|
||||
//! tree-sitter [Parser][], and then use the parser to parse some code:
|
||||
//! Typically, you will use the [`LANGUAGE`] constant to add this language to a
|
||||
//! tree-sitter [`Parser`], and then use the parser to parse some code:
|
||||
//!
|
||||
//! ```
|
||||
//! let code = r#"
|
||||
@@ -15,7 +15,7 @@
|
||||
//! assert!(!tree.root_node().has_error());
|
||||
//! ```
|
||||
//!
|
||||
//! [Parser]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Parser.html
|
||||
//! [`Parser`]: https://docs.rs/tree-sitter/0.25.10/tree_sitter/struct.Parser.html
|
||||
//! [tree-sitter]: https://tree-sitter.github.io/
|
||||
|
||||
use tree_sitter_language::LanguageFn;
|
||||
@@ -24,22 +24,20 @@ extern "C" {
|
||||
fn tree_sitter_bruno() -> *const ();
|
||||
}
|
||||
|
||||
/// The tree-sitter [`LanguageFn`][LanguageFn] for this grammar.
|
||||
///
|
||||
/// [LanguageFn]: https://docs.rs/tree-sitter-language/*/tree_sitter_language/struct.LanguageFn.html
|
||||
/// The tree-sitter [`LanguageFn`] for this grammar.
|
||||
pub const LANGUAGE: LanguageFn = unsafe { LanguageFn::from_raw(tree_sitter_bruno) };
|
||||
|
||||
/// The content of the [`node-types.json`][] file for this grammar.
|
||||
/// The content of the [`node-types.json`] file for this grammar.
|
||||
///
|
||||
/// [`node-types.json`]: https://tree-sitter.github.io/tree-sitter/using-parsers#static-node-types
|
||||
/// [`node-types.json`]: https://tree-sitter.github.io/tree-sitter/using-parsers/6-static-node-types
|
||||
pub const NODE_TYPES: &str = include_str!("../../src/node-types.json");
|
||||
|
||||
// NOTE: uncomment these to include any queries that this grammar contains:
|
||||
|
||||
pub const HIGHLIGHTS_QUERY: &str = include_str!("../../queries/bruno/highlights.scm");
|
||||
pub const INJECTIONS_QUERY: &str = include_str!("../../queries/bruno/injections.scm");
|
||||
// pub const LOCALS_QUERY: &str = include_str!("../../queries/bruno/locals.scm");
|
||||
pub const TAGS_QUERY: &str = include_str!("../../queries/bruno/tags.scm");
|
||||
// pub const HIGHLIGHTS_QUERY: &str = include_str!("../../queries/highlights.scm");
|
||||
// pub const INJECTIONS_QUERY: &str = include_str!("../../queries/injections.scm");
|
||||
// pub const LOCALS_QUERY: &str = include_str!("../../queries/locals.scm");
|
||||
// pub const TAGS_QUERY: &str = include_str!("../../queries/tags.scm");
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
Reference in New Issue
Block a user