Compare commits

...

6 Commits

55 changed files with 2311 additions and 3392 deletions

View File

@@ -41,3 +41,6 @@ indent_size = 8
[parser.c] [parser.c]
indent_size = 2 indent_size = 2
[{alloc,array,parser}.h]
indent_size = 2

39
.gitattributes vendored
View File

@@ -1,13 +1,42 @@
* text=auto eol=lf * text=auto eol=lf
# Generated source files
src/*.json linguist-generated src/*.json linguist-generated
src/parser.c linguist-generated src/parser.c linguist-generated
src/tree_sitter/* linguist-generated src/tree_sitter/* linguist-generated
bindings/** linguist-generated # C bindings
binding.gyp linguist-generated bindings/c/** linguist-generated
setup.py linguist-generated
Makefile linguist-generated
CMakeLists.txt linguist-generated CMakeLists.txt linguist-generated
Package.swift linguist-generated Makefile linguist-generated
# Rust bindings
bindings/rust/* linguist-generated
Cargo.toml linguist-generated
Cargo.lock linguist-generated
# Node.js bindings
bindings/node/* linguist-generated
binding.gyp linguist-generated
package.json linguist-generated
package-lock.json linguist-generated
# Python bindings
bindings/python/** linguist-generated
setup.py linguist-generated
pyproject.toml linguist-generated
# Go bindings
bindings/go/* linguist-generated
go.mod linguist-generated go.mod linguist-generated
go.sum linguist-generated
# Swift bindings
bindings/swift/** linguist-generated
Package.swift linguist-generated
Package.resolved linguist-generated
# Zig bindings
bindings/zig/* linguist-generated
build.zig linguist-generated
build.zig.zon linguist-generated

10
.gitignore vendored
View File

@@ -1,13 +1,16 @@
# Rust artifacts # Rust artifacts
target/ target/
Cargo.lock
# Node artifacts # Node artifacts
build/ build/
prebuilds/ prebuilds/
node_modules/ node_modules/
package-lock.json
# Swift artifacts # Swift artifacts
.build/ .build/
Package.resolved
# Go artifacts # Go artifacts
_obj/ _obj/
@@ -25,6 +28,13 @@ dist/
*.dylib *.dylib
*.dll *.dll
*.pc *.pc
*.exp
*.lib
# Zig artifacts
.zig-cache/
zig-cache/
zig-out/
# Example dirs # Example dirs
/examples/*/ /examples/*/

32
CMakeLists.txt generated
View File

@@ -2,19 +2,21 @@ cmake_minimum_required(VERSION 3.13)
project(tree-sitter-bruno project(tree-sitter-bruno
VERSION "0.1.0" VERSION "0.1.0"
DESCRIPTION " Bruno grammar for tree-sitter" DESCRIPTION "Bruno grammar for tree-sitter"
HOMEPAGE_URL "https://github.com/kristoferssolo/tree-sitter-bruno" HOMEPAGE_URL "https://codeberg.org/kristoferssolo/tree-sitter-bruno"
LANGUAGES C) LANGUAGES C)
option(BUILD_SHARED_LIBS "Build using shared libraries" ON) option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
option(TREE_SITTER_REUSE_ALLOCATOR "Reuse the library allocator" OFF) option(TREE_SITTER_REUSE_ALLOCATOR "Reuse the library allocator" OFF)
set(TREE_SITTER_ABI_VERSION 14 CACHE STRING "Tree-sitter ABI version") set(TREE_SITTER_ABI_VERSION 15 CACHE STRING "Tree-sitter ABI version")
if(NOT ${TREE_SITTER_ABI_VERSION} MATCHES "^[0-9]+$") if(NOT ${TREE_SITTER_ABI_VERSION} MATCHES "^[0-9]+$")
unset(TREE_SITTER_ABI_VERSION CACHE) unset(TREE_SITTER_ABI_VERSION CACHE)
message(FATAL_ERROR "TREE_SITTER_ABI_VERSION must be an integer") message(FATAL_ERROR "TREE_SITTER_ABI_VERSION must be an integer")
endif() endif()
include(GNUInstallDirs)
find_program(TREE_SITTER_CLI tree-sitter DOC "Tree-sitter CLI") find_program(TREE_SITTER_CLI tree-sitter DOC "Tree-sitter CLI")
add_custom_command(OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/src/parser.c" add_custom_command(OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/src/parser.c"
@@ -25,10 +27,13 @@ add_custom_command(OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/src/parser.c"
COMMENT "Generating parser.c") COMMENT "Generating parser.c")
add_library(tree-sitter-bruno src/parser.c) add_library(tree-sitter-bruno src/parser.c)
if(EXISTS src/scanner.c) if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/scanner.c)
target_sources(tree-sitter-bruno PRIVATE src/scanner.c) target_sources(tree-sitter-bruno PRIVATE src/scanner.c)
endif() endif()
target_include_directories(tree-sitter-bruno PRIVATE src) target_include_directories(tree-sitter-bruno
PRIVATE src
INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/bindings/c>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
target_compile_definitions(tree-sitter-bruno PRIVATE target_compile_definitions(tree-sitter-bruno PRIVATE
$<$<BOOL:${TREE_SITTER_REUSE_ALLOCATOR}>:TREE_SITTER_REUSE_ALLOCATOR> $<$<BOOL:${TREE_SITTER_REUSE_ALLOCATOR}>:TREE_SITTER_REUSE_ALLOCATOR>
@@ -44,17 +49,18 @@ set_target_properties(tree-sitter-bruno
configure_file(bindings/c/tree-sitter-bruno.pc.in configure_file(bindings/c/tree-sitter-bruno.pc.in
"${CMAKE_CURRENT_BINARY_DIR}/tree-sitter-bruno.pc" @ONLY) "${CMAKE_CURRENT_BINARY_DIR}/tree-sitter-bruno.pc" @ONLY)
include(GNUInstallDirs) install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bindings/c/tree_sitter"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
install(FILES bindings/c/tree-sitter-bruno.h FILES_MATCHING PATTERN "*.h")
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/tree_sitter")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/tree-sitter-bruno.pc" install(FILES "${CMAKE_CURRENT_BINARY_DIR}/tree-sitter-bruno.pc"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig") DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
install(TARGETS tree-sitter-bruno install(TARGETS tree-sitter-bruno
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
add_custom_target(test "${TREE_SITTER_CLI}" test file(GLOB QUERIES queries/*.scm)
install(FILES ${QUERIES}
DESTINATION "${CMAKE_INSTALL_DATADIR}/tree-sitter/queries/bruno")
add_custom_target(ts-test "${TREE_SITTER_CLI}" test
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT "tree-sitter test") COMMENT "tree-sitter test")
# vim:ft=cmake:

96
Cargo.lock generated
View File

@@ -1,96 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "aho-corasick"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
dependencies = [
"memchr",
]
[[package]]
name = "cc"
version = "1.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9157bbaa6b165880c27a4293a474c91cdcf265cc68cc829bf10be0964a391caf"
dependencies = [
"shlex",
]
[[package]]
name = "memchr"
version = "2.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
[[package]]
name = "regex"
version = "1.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
dependencies = [
"aho-corasick",
"memchr",
"regex-automata",
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
[[package]]
name = "shlex"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
[[package]]
name = "streaming-iterator"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b2231b7c3057d5e4ad0156fb3dc807d900806020c5ffa3ee6ff2c8c76fb8520"
[[package]]
name = "tree-sitter"
version = "0.24.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ac95b18f0f727aaaa012bd5179a1916706ee3ed071920fdbda738750b0c0bf5"
dependencies = [
"cc",
"regex",
"regex-syntax",
"streaming-iterator",
"tree-sitter-language",
]
[[package]]
name = "tree-sitter-bruno"
version = "0.1.0"
dependencies = [
"cc",
"tree-sitter",
"tree-sitter-language",
]
[[package]]
name = "tree-sitter-language"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c199356c799a8945965bb5f2c55b2ad9d9aa7c4b4f6e587fe9dea0bc715e5f9c"

19
Cargo.toml generated
View File

@@ -1,18 +1,25 @@
[package] [package]
name = "tree-sitter-bruno" name = "tree-sitter-bruno"
description = " Bruno grammar for tree-sitter" description = "Bruno grammar for tree-sitter"
version = "0.1.0" version = "0.1.0"
authors = ["Kristofers Solo <dev@kristofers.xyz>"] authors = ["Kristofers Solo <dev@kristofers.xyz>"]
license = "MIT" license = "MIT"
readme = "README.md" readme = "README.md"
keywords = ["incremental", "parsing", "tree-sitter", "bruno"] keywords = ["incremental", "parsing", "tree-sitter", "bruno"]
categories = ["parsing", "text-editors"] categories = ["parser-implementations", "parsing", "text-editors"]
repository = "https://github.com/kristoferssolo/tree-sitter-bruno" repository = "https://codeberg.org/kristoferssolo/tree-sitter-bruno"
edition = "2021" edition = "2021"
autoexamples = false autoexamples = false
build = "bindings/rust/build.rs" build = "bindings/rust/build.rs"
include = ["bindings/rust/*", "grammar.js", "queries/*", "src/*"] include = [
"bindings/rust/*",
"grammar.js",
"queries/*",
"src/*",
"tree-sitter.json",
"/LICENSE",
]
[lib] [lib]
path = "bindings/rust/lib.rs" path = "bindings/rust/lib.rs"
@@ -21,7 +28,7 @@ path = "bindings/rust/lib.rs"
tree-sitter-language = "0.1" tree-sitter-language = "0.1"
[build-dependencies] [build-dependencies]
cc = "1.1.22" cc = "1.2"
[dev-dependencies] [dev-dependencies]
tree-sitter = "0.24.3" tree-sitter = "0.25.10"

11
Makefile generated
View File

@@ -3,7 +3,7 @@ $(error Windows is not supported)
endif endif
LANGUAGE_NAME := tree-sitter-bruno LANGUAGE_NAME := tree-sitter-bruno
HOMEPAGE_URL := https://github.com/kristoferssolo/tree-sitter-bruno HOMEPAGE_URL := https://codeberg.org/kristoferssolo/tree-sitter-bruno
VERSION := 0.1.0 VERSION := 0.1.0
# repository # repository
@@ -13,6 +13,7 @@ TS ?= tree-sitter
# install directory layout # install directory layout
PREFIX ?= /usr/local PREFIX ?= /usr/local
DATADIR ?= $(PREFIX)/share
INCLUDEDIR ?= $(PREFIX)/include INCLUDEDIR ?= $(PREFIX)/include
LIBDIR ?= $(PREFIX)/lib LIBDIR ?= $(PREFIX)/lib
PCLIBDIR ?= $(LIBDIR)/pkgconfig PCLIBDIR ?= $(LIBDIR)/pkgconfig
@@ -69,13 +70,16 @@ $(PARSER): $(SRC_DIR)/grammar.json
$(TS) generate $^ $(TS) generate $^
install: all install: all
install -d '$(DESTDIR)$(INCLUDEDIR)'/tree_sitter '$(DESTDIR)$(PCLIBDIR)' '$(DESTDIR)$(LIBDIR)' install -d '$(DESTDIR)$(DATADIR)'/tree-sitter/queries/bruno '$(DESTDIR)$(INCLUDEDIR)'/tree_sitter '$(DESTDIR)$(PCLIBDIR)' '$(DESTDIR)$(LIBDIR)'
install -m644 bindings/c/$(LANGUAGE_NAME).h '$(DESTDIR)$(INCLUDEDIR)'/tree_sitter/$(LANGUAGE_NAME).h install -m644 bindings/c/tree_sitter/$(LANGUAGE_NAME).h '$(DESTDIR)$(INCLUDEDIR)'/tree_sitter/$(LANGUAGE_NAME).h
install -m644 $(LANGUAGE_NAME).pc '$(DESTDIR)$(PCLIBDIR)'/$(LANGUAGE_NAME).pc install -m644 $(LANGUAGE_NAME).pc '$(DESTDIR)$(PCLIBDIR)'/$(LANGUAGE_NAME).pc
install -m644 lib$(LANGUAGE_NAME).a '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).a install -m644 lib$(LANGUAGE_NAME).a '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).a
install -m755 lib$(LANGUAGE_NAME).$(SOEXT) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXTVER) install -m755 lib$(LANGUAGE_NAME).$(SOEXT) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXTVER)
ln -sf lib$(LANGUAGE_NAME).$(SOEXTVER) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXTVER_MAJOR) ln -sf lib$(LANGUAGE_NAME).$(SOEXTVER) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXTVER_MAJOR)
ln -sf lib$(LANGUAGE_NAME).$(SOEXTVER_MAJOR) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXT) ln -sf lib$(LANGUAGE_NAME).$(SOEXTVER_MAJOR) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXT)
ifneq ($(wildcard queries/*.scm),)
install -m644 queries/*.scm '$(DESTDIR)$(DATADIR)'/tree-sitter/queries/bruno
endif
uninstall: uninstall:
$(RM) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).a \ $(RM) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).a \
@@ -84,6 +88,7 @@ uninstall:
'$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXT) \ '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXT) \
'$(DESTDIR)$(INCLUDEDIR)'/tree_sitter/$(LANGUAGE_NAME).h \ '$(DESTDIR)$(INCLUDEDIR)'/tree_sitter/$(LANGUAGE_NAME).h \
'$(DESTDIR)$(PCLIBDIR)'/$(LANGUAGE_NAME).pc '$(DESTDIR)$(PCLIBDIR)'/$(LANGUAGE_NAME).pc
$(RM) -r '$(DESTDIR)$(DATADIR)'/tree-sitter/queries/bruno
clean: clean:
$(RM) $(OBJS) $(LANGUAGE_NAME).pc lib$(LANGUAGE_NAME).a lib$(LANGUAGE_NAME).$(SOEXT) $(RM) $(OBJS) $(LANGUAGE_NAME).pc lib$(LANGUAGE_NAME).a lib$(LANGUAGE_NAME).$(SOEXT)

14
Package.swift generated
View File

@@ -1,23 +1,27 @@
// swift-tools-version:5.3 // swift-tools-version:5.3
import Foundation
import PackageDescription import PackageDescription
var sources = ["src/parser.c"]
if FileManager.default.fileExists(atPath: "src/scanner.c") {
sources.append("src/scanner.c")
}
let package = Package( let package = Package(
name: "TreeSitterBruno", name: "TreeSitterBruno",
products: [ products: [
.library(name: "TreeSitterBruno", targets: ["TreeSitterBruno"]), .library(name: "TreeSitterBruno", targets: ["TreeSitterBruno"]),
], ],
dependencies: [ dependencies: [
.package(url: "https://github.com/ChimeHQ/SwiftTreeSitter", from: "0.8.0"), .package(name: "SwiftTreeSitter", url: "https://github.com/tree-sitter/swift-tree-sitter", from: "0.9.0"),
], ],
targets: [ targets: [
.target( .target(
name: "TreeSitterBruno", name: "TreeSitterBruno",
dependencies: [], dependencies: [],
path: ".", path: ".",
sources: [ sources: sources,
"src/parser.c",
"src/scanner.c",
],
resources: [ resources: [
.copy("queries") .copy("queries")
], ],

7
binding.gyp generated
View File

@@ -11,9 +11,14 @@
"sources": [ "sources": [
"bindings/node/binding.cc", "bindings/node/binding.cc",
"src/parser.c", "src/parser.c",
"src/scanner.c",
], ],
"variables": {
"has_scanner": "<!(node -p \"fs.existsSync('src/scanner.c')\")"
},
"conditions": [ "conditions": [
["has_scanner=='true'", {
"sources+": ["src/scanner.c"],
}],
["OS!='win'", { ["OS!='win'", {
"cflags_c": [ "cflags_c": [
"-std=c11", "-std=c11",

View File

@@ -6,6 +6,5 @@ Name: tree-sitter-bruno
Description: @PROJECT_DESCRIPTION@ Description: @PROJECT_DESCRIPTION@
URL: @PROJECT_HOMEPAGE_URL@ URL: @PROJECT_HOMEPAGE_URL@
Version: @PROJECT_VERSION@ Version: @PROJECT_VERSION@
Requires: @TS_REQUIRES@
Libs: -L${libdir} -ltree-sitter-bruno Libs: -L${libdir} -ltree-sitter-bruno
Cflags: -I${includedir} Cflags: -I${includedir}

View File

@@ -2,7 +2,9 @@ package tree_sitter_bruno
// #cgo CFLAGS: -std=c11 -fPIC // #cgo CFLAGS: -std=c11 -fPIC
// #include "../../src/parser.c" // #include "../../src/parser.c"
// #if __has_include("../../src/scanner.c")
// #include "../../src/scanner.c" // #include "../../src/scanner.c"
// #endif
import "C" import "C"
import "unsafe" import "unsafe"

View File

@@ -4,7 +4,7 @@ import (
"testing" "testing"
tree_sitter "github.com/tree-sitter/go-tree-sitter" 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) { func TestCanLoadGrammar(t *testing.T) {

View File

@@ -10,7 +10,6 @@ const napi_type_tag LANGUAGE_TYPE_TAG = {
}; };
Napi::Object Init(Napi::Env env, Napi::Object exports) { 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()); auto language = Napi::External<TSLanguage>::New(env, tree_sitter_bruno());
language.TypeTag(&LANGUAGE_TYPE_TAG); language.TypeTag(&LANGUAGE_TYPE_TAG);
exports["language"] = language; exports["language"] = language;

View File

@@ -1,9 +1,9 @@
/// <reference types="node" />
const assert = require("node:assert"); const assert = require("node:assert");
const { test } = require("node:test"); const { test } = require("node:test");
const Parser = require("tree-sitter");
test("can load grammar", () => { test("can load grammar", () => {
const parser = new (require("tree-sitter"))(); const parser = new Parser();
assert.doesNotThrow(() => parser.setLanguage(require("."))); assert.doesNotThrow(() => parser.setLanguage(require(".")));
}); });

1
bindings/node/index.d.ts generated vendored
View File

@@ -19,7 +19,6 @@ type NodeInfo =
}); });
type Language = { type Language = {
name: string;
language: unknown; language: unknown;
nodeTypeInfo: NodeInfo[]; nodeTypeInfo: NodeInfo[];
}; };

View File

@@ -1,6 +1,10 @@
const root = require("path").join(__dirname, "..", ".."); 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 { try {
module.exports.nodeTypeInfo = require("../../src/node-types.json"); module.exports.nodeTypeInfo = require("../../src/node-types.json");

View File

@@ -1,13 +1,12 @@
from unittest import TestCase from unittest import TestCase
from tree_sitter import Language, Parser
import tree_sitter_bruno import tree_sitter_bruno
import tree_sitter
class TestLanguage(TestCase): class TestLanguage(TestCase):
def test_can_load_grammar(self): def test_can_load_grammar(self):
try: try:
tree_sitter.Language(tree_sitter_bruno.language()) Parser(Language(tree_sitter_bruno.language()))
except Exception: except Exception:
self.fail("Error loading Bruno grammar") self.fail("Error loading Bruno grammar")

View File

@@ -6,7 +6,7 @@ from ._binding import language
def _get_query(name, file): def _get_query(name, file):
query = _files(f"{__package__}.queries") / "bruno" / file query = _files(f"{__package__}.queries") / file
globals()[name] = query.read_text() globals()[name] = query.read_text()
return globals()[name] return globals()[name]
@@ -14,14 +14,14 @@ def _get_query(name, file):
def __getattr__(name): def __getattr__(name):
# NOTE: uncomment these to include any queries that this grammar contains: # NOTE: uncomment these to include any queries that this grammar contains:
if name == "HIGHLIGHTS_QUERY": # if name == "HIGHLIGHTS_QUERY":
return _get_query("HIGHLIGHTS_QUERY", "highlights.scm") # return _get_query("HIGHLIGHTS_QUERY", "highlights.scm")
if name == "INJECTIONS_QUERY": # if name == "INJECTIONS_QUERY":
return _get_query("INJECTIONS_QUERY", "injections.scm") # return _get_query("INJECTIONS_QUERY", "injections.scm")
# if name == "LOCALS_QUERY": # if name == "LOCALS_QUERY":
# return _get_query("LOCALS_QUERY", "locals.scm") # return _get_query("LOCALS_QUERY", "locals.scm")
if name == "TAGS_QUERY": # if name == "TAGS_QUERY":
return _get_query("TAGS_QUERY", "tags.scm") # return _get_query("TAGS_QUERY", "tags.scm")
raise AttributeError(f"module {__name__!r} has no attribute {name!r}") raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
@@ -36,18 +36,7 @@ __all__ = [
def __dir__(): def __dir__():
return sorted( return sorted(__all__ + [
__all__ "__all__", "__builtins__", "__cached__", "__doc__", "__file__",
+ [ "__loader__", "__name__", "__package__", "__path__", "__spec__",
"__all__", ])
"__builtins__",
"__cached__",
"__doc__",
"__file__",
"__loader__",
"__name__",
"__package__",
"__path__",
"__spec__",
]
)

View File

@@ -2,9 +2,9 @@ from typing import Final
# NOTE: uncomment these to include any queries that this grammar contains: # NOTE: uncomment these to include any queries that this grammar contains:
HIGHLIGHTS_QUERY: Final[str] # HIGHLIGHTS_QUERY: Final[str]
INJECTIONS_QUERY: Final[str] # INJECTIONS_QUERY: Final[str]
# LOCALS_QUERY: Final[str] # LOCALS_QUERY: Final[str]
TAGS_QUERY: Final[str] # TAGS_QUERY: Final[str]
def language() -> object: ... def language() -> object: ...

View File

@@ -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); 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[] = { static PyMethodDef methods[] = {
{"language", _binding_language, METH_NOARGS, {"language", _binding_language, METH_NOARGS,
"Get the tree-sitter language for this grammar."}, "Get the tree-sitter language for this grammar."},
@@ -18,10 +25,11 @@ static struct PyModuleDef module = {
.m_base = PyModuleDef_HEAD_INIT, .m_base = PyModuleDef_HEAD_INIT,
.m_name = "_binding", .m_name = "_binding",
.m_doc = NULL, .m_doc = NULL,
.m_size = -1, .m_size = 0,
.m_methods = methods .m_methods = methods,
.m_slots = slots,
}; };
PyMODINIT_FUNC PyInit__binding(void) { PyMODINIT_FUNC PyInit__binding(void) {
return PyModule_Create(&module); return PyModuleDef_Init(&module);
} }

View File

@@ -12,8 +12,10 @@ fn main() {
println!("cargo:rerun-if-changed={}", parser_path.to_str().unwrap()); println!("cargo:rerun-if-changed={}", parser_path.to_str().unwrap());
let scanner_path = src_dir.join("scanner.c"); let scanner_path = src_dir.join("scanner.c");
c_config.file(&scanner_path); if scanner_path.exists() {
println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap()); c_config.file(&scanner_path);
println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap());
}
c_config.compile("tree-sitter-bruno"); c_config.compile("tree-sitter-bruno");
} }

24
bindings/rust/lib.rs generated
View File

@@ -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 //! 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: //! tree-sitter [`Parser`], and then use the parser to parse some code:
//! //!
//! ``` //! ```
//! let code = r#" //! let code = r#"
@@ -15,7 +15,7 @@
//! assert!(!tree.root_node().has_error()); //! 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/ //! [tree-sitter]: https://tree-sitter.github.io/
use tree_sitter_language::LanguageFn; use tree_sitter_language::LanguageFn;
@@ -24,22 +24,20 @@ extern "C" {
fn tree_sitter_bruno() -> *const (); fn tree_sitter_bruno() -> *const ();
} }
/// The tree-sitter [`LanguageFn`][LanguageFn] for this grammar. /// The tree-sitter [`LanguageFn`] for this grammar.
///
/// [LanguageFn]: https://docs.rs/tree-sitter-language/*/tree_sitter_language/struct.LanguageFn.html
pub const LANGUAGE: LanguageFn = unsafe { LanguageFn::from_raw(tree_sitter_bruno) }; 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"); pub const NODE_TYPES: &str = include_str!("../../src/node-types.json");
// NOTE: uncomment these to include any queries that this grammar contains: // NOTE: uncomment these to include any queries that this grammar contains:
pub const HIGHLIGHTS_QUERY: &str = include_str!("../../queries/bruno/highlights.scm"); // pub const HIGHLIGHTS_QUERY: &str = include_str!("../../queries/highlights.scm");
pub const INJECTIONS_QUERY: &str = include_str!("../../queries/bruno/injections.scm"); // pub const INJECTIONS_QUERY: &str = include_str!("../../queries/injections.scm");
// pub const LOCALS_QUERY: &str = include_str!("../../queries/bruno/locals.scm"); // pub const LOCALS_QUERY: &str = include_str!("../../queries/locals.scm");
pub const TAGS_QUERY: &str = include_str!("../../queries/bruno/tags.scm"); // pub const TAGS_QUERY: &str = include_str!("../../queries/tags.scm");
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {

4
go.mod generated
View File

@@ -1,5 +1,5 @@
module github.com/kristoferssolo/tree-sitter-bruno module codeberg.org/kristoferssolo/tree-sitter-bruno
go 1.22 go 1.22
require github.com/tree-sitter/go-tree-sitter v0.23.1 require github.com/tree-sitter/go-tree-sitter v0.24.0

View File

@@ -1,5 +1,5 @@
/** /**
* @file Bruno grammar for tree-sitter * @file Bruno grammar for tree-sitter
* @author Kristofers Solo <dev@kristofers.xyz> * @author Kristofers Solo <dev@kristofers.xyz>
* @license MIT * @license MIT
*/ */
@@ -8,35 +8,33 @@
// @ts-check // @ts-check
module.exports = grammar({ module.exports = grammar({
name: "bruno", name: "bruno",
extras: (_) => [/\s+|(\r?\n)/],
extras: (_) => [/\s/],
externals: ($) => [$.rawtext], externals: ($) => [$.rawtext],
rules: { rules: {
source_file: ($) => source_file: ($) => repeat($.section),
repeat(
field( section: ($) =>
"tag", choice(
choice( $.meta,
$.meta, $.http,
$.http, $.query,
$.query, $.headers,
$.headers, $.auth,
$.auths, $.body,
$.bodies, $.vars,
$.varsandassert, $.assert,
$.script, $.params,
$.tests, $.script,
$.docs, $.tests,
), $.docs,
),
), ),
meta: ($) => seq(alias("meta", $.keyword), $.dictionary), meta: ($) => seq(alias("meta", $.keyword), $.object_block),
http: ($) => seq(alias($.http_verb, $.keyword), $.dictionary), http: ($) => seq(alias($.http_verb, $.keyword), $.object_block),
http_verb: (_) => http_verb: (_) =>
choice( choice(
"get", "get",
@@ -50,11 +48,11 @@ module.exports = grammar({
"trace", "trace",
), ),
query: ($) => seq(alias("query", $.keyword), $.dictionary), query: ($) => seq(alias("query", $.keyword), $.object_block),
headers: ($) => seq(alias("headers", $.keyword), $.dictionary), headers: ($) => seq(alias("headers", $.keyword), $.object_block),
auths: ($) => auth: ($) =>
choice( choice(
$.authawsv4, $.authawsv4,
$.authbasic, $.authbasic,
@@ -62,13 +60,13 @@ module.exports = grammar({
$.authdigest, $.authdigest,
$.authoauth2, $.authoauth2,
), ),
authawsv4: ($) => seq(alias("auth:awsv4", $.keyword), $.dictionary), authawsv4: ($) => seq(alias("auth:awsv4", $.keyword), $.object_block),
authbasic: ($) => seq(alias("auth:basic", $.keyword), $.dictionary), authbasic: ($) => seq(alias("auth:basic", $.keyword), $.object_block),
authbearer: ($) => seq(alias("auth:bearer", $.keyword), $.dictionary), authbearer: ($) => seq(alias("auth:bearer", $.keyword), $.object_block),
authdigest: ($) => seq(alias("auth:digest", $.keyword), $.dictionary), authdigest: ($) => seq(alias("auth:digest", $.keyword), $.object_block),
authoauth2: ($) => seq(alias("auth:oauth2", $.keyword), $.dictionary), authoauth2: ($) => seq(alias("auth:oauth2", $.keyword), $.object_block),
bodies: ($) => body: ($) =>
choice( choice(
$.bodyjson, $.bodyjson,
$.bodytext, $.bodytext,
@@ -76,11 +74,11 @@ module.exports = grammar({
$.bodysparql, $.bodysparql,
$.bodygraphql, $.bodygraphql,
$.bodygraphqlvars, $.bodygraphqlvars,
$.bodyforms, $.bodyformurlencoded,
$.body, $.bodyformmultipart,
$.bodyraw,
), ),
bodyforms: ($) => choice($.bodyformurlencoded, $.bodyformmultipart), bodyraw: ($) => seq(alias("body", $.keyword), $.textblock),
body: ($) => seq(alias("body", $.keyword), $.textblock),
bodyjson: ($) => seq(alias("body:json", $.keyword), $.textblock), bodyjson: ($) => seq(alias("body:json", $.keyword), $.textblock),
bodytext: ($) => seq(alias("body:text", $.keyword), $.textblock), bodytext: ($) => seq(alias("body:text", $.keyword), $.textblock),
bodyxml: ($) => seq(alias("body:xml", $.keyword), $.textblock), bodyxml: ($) => seq(alias("body:xml", $.keyword), $.textblock),
@@ -89,18 +87,18 @@ module.exports = grammar({
bodygraphqlvars: ($) => bodygraphqlvars: ($) =>
seq(alias("body:graphql:vars", $.keyword), $.textblock), seq(alias("body:graphql:vars", $.keyword), $.textblock),
bodyformurlencoded: ($) => bodyformurlencoded: ($) =>
seq(alias("body:form-urlencoded", $.keyword), $.dictionary), seq(alias("body:form-urlencoded", $.keyword), $.object_block),
bodyformmultipart: ($) => bodyformmultipart: ($) =>
seq(alias("body:multipart-form", $.keyword), $.dictionary), seq(alias("body:multipart-form", $.keyword), $.object_block),
varsandassert: ($) => vars: ($) =>
choice($.vars, $.vars_secret, $.varsreq, $.varsres, $.assert, $.params), choice($.vars_plain, $.vars_secret, $.varsreq, $.varsres),
vars: ($) => seq(alias("vars", $.keyword), $.dictionary), vars_plain: ($) => seq(alias("vars", $.keyword), $.object_block),
vars_secret: ($) => seq(alias("vars:secret", $.keyword), $.array), vars_secret: ($) => seq(alias("vars:secret", $.keyword), $.array_block),
varsreq: ($) => seq(alias("vars:pre-request", $.keyword), $.dictionary), varsreq: ($) => seq(alias("vars:pre-request", $.keyword), $.object_block),
varsres: ($) => seq(alias("vars:post-response", $.keyword), $.dictionary), varsres: ($) => seq(alias("vars:post-response", $.keyword), $.object_block),
assert: ($) => seq(alias("assert", $.keyword), $.assert_dictionary), assert: ($) => seq(alias("assert", $.keyword), $.assert_block),
script: ($) => choice($.scriptreq, $.scriptres), script: ($) => choice($.scriptreq, $.scriptres),
scriptreq: ($) => seq(alias("script:pre-request", $.keyword), $.textblock), scriptreq: ($) => seq(alias("script:pre-request", $.keyword), $.textblock),
@@ -108,26 +106,33 @@ module.exports = grammar({
seq(alias("script:post-response", $.keyword), $.textblock), seq(alias("script:post-response", $.keyword), $.textblock),
params: ($) => choice($.params_path, $.params_query), params: ($) => choice($.params_path, $.params_query),
params_query: ($) => seq(alias("params:query", $.keyword), $.dictionary), params_query: ($) => seq(alias("params:query", $.keyword), $.object_block),
params_path: ($) => seq(alias("params:path", $.keyword), $.dictionary), params_path: ($) => seq(alias("params:path", $.keyword), $.object_block),
tests: ($) => seq(alias("tests", $.keyword), $.textblock), tests: ($) => seq(alias("tests", $.keyword), $.textblock),
docs: ($) => seq(alias("docs", $.keyword), $.textblock), docs: ($) => seq(alias("docs", $.keyword), $.textblock),
object_block: ($) => seq("{", repeat($.dictionary_pair), "}"),
dictionary_pair: ($) => seq($.key, ":", $.dictionary_value),
dictionary_value: ($) =>
choice($.template_value, $.quoted_value, $.bare_value),
assert_block: ($) => seq("{", repeat($.assert_dictionary_pair), "}"),
assert_dictionary_pair: ($) => seq($.assert_key, ":", $.dictionary_value),
array_block: ($) => seq("[", repeat(seq($.array_value, optional(","))), "]"),
array_value: ($) =>
choice($.template_value, $.quoted_value, $.bare_value),
textblock: ($) => seq("{", optional($.rawtext), "}"), textblock: ($) => seq("{", optional($.rawtext), "}"),
array: ($) => seq("[", repeat(seq($.array_value, optional(","))), "]"),
array_value: (_) => /[^\r\n\s\t\[\],]+/,
dictionary: ($) => seq("{", repeat($.dictionary_pair), "}"),
dictionary_pair: ($) => seq($.key, ":", $.value),
assert_dictionary: ($) => seq("{", repeat($.assert_dictionary_pair), "}"),
assert_dictionary_pair: ($) => seq($.assert_key, ":", $.value),
assert_key: (_) => /[^\r\n:]+/, assert_key: (_) => /[^\r\n:]+/,
key: (_) => /[^\s\r\n:]+/, key: (_) => /[^\s\r\n:]+/,
value: (_) => /[^\r\n]*/, bare_value: (_) => /[^\s\r\n",\]}][^\r\n]*/,
}, quoted_value: (_) => token(seq('"', repeat(choice(/[^"\\]+/, /\\./)), '"')),
template_value: (_) =>
token(seq("{{", repeat(choice(/[^}]+/, /}[^}]/)), "}}")),
},
}); });

392
package-lock.json generated
View File

@@ -1,392 +0,0 @@
{
"name": "tree-sitter-bruno",
"version": "0.1.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "tree-sitter-bruno",
"version": "0.1.0",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
"node": "^23.4.0",
"node-addon-api": "^8.1.0",
"node-gyp-build": "^4.8.2"
},
"devDependencies": {
"prebuildify": "^6.0.1",
"tree-sitter-cli": "^0.24.3"
},
"peerDependencies": {
"tree-sitter": "^0.21.1"
},
"peerDependenciesMeta": {
"tree-sitter": {
"optional": true
}
}
},
"node_modules/base64-js": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
"dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "MIT"
},
"node_modules/bl": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
"integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==",
"dev": true,
"license": "MIT",
"dependencies": {
"buffer": "^5.5.0",
"inherits": "^2.0.4",
"readable-stream": "^3.4.0"
}
},
"node_modules/buffer": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
"integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
"dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "MIT",
"dependencies": {
"base64-js": "^1.3.1",
"ieee754": "^1.1.13"
}
},
"node_modules/chownr": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz",
"integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==",
"dev": true,
"license": "ISC"
},
"node_modules/end-of-stream": {
"version": "1.4.4",
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
"integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
"dev": true,
"license": "MIT",
"dependencies": {
"once": "^1.4.0"
}
},
"node_modules/fs-constants": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
"integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==",
"dev": true,
"license": "MIT"
},
"node_modules/ieee754": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
"integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
"dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "BSD-3-Clause"
},
"node_modules/inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
"dev": true,
"license": "ISC"
},
"node_modules/minimist": {
"version": "1.2.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
"dev": true,
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/mkdirp-classic": {
"version": "0.5.3",
"resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz",
"integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==",
"dev": true,
"license": "MIT"
},
"node_modules/node": {
"version": "23.4.0",
"resolved": "https://registry.npmjs.org/node/-/node-23.4.0.tgz",
"integrity": "sha512-uzDNv0OyY8xC7x1/CuYx2c9G3g33GznkhPFs89Q2trrk7M9JzYFj8nlEbv9E666ihJdop+WaeCQST2Hbm/iKuw==",
"hasInstallScript": true,
"license": "ISC",
"dependencies": {
"node-bin-setup": "^1.0.0"
},
"bin": {
"node": "bin/node"
},
"engines": {
"npm": ">=5.0.0"
}
},
"node_modules/node-abi": {
"version": "3.71.0",
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.71.0.tgz",
"integrity": "sha512-SZ40vRiy/+wRTf21hxkkEjPJZpARzUMVcJoQse2EF8qkUWbbO2z7vd5oA/H6bVH6SZQ5STGcu0KRDS7biNRfxw==",
"dev": true,
"license": "MIT",
"dependencies": {
"semver": "^7.3.5"
},
"engines": {
"node": ">=10"
}
},
"node_modules/node-addon-api": {
"version": "8.3.0",
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-8.3.0.tgz",
"integrity": "sha512-8VOpLHFrOQlAH+qA0ZzuGRlALRA6/LVh8QJldbrC4DY0hXoMP0l4Acq8TzFC018HztWiRqyCEj2aTWY2UvnJUg==",
"license": "MIT",
"engines": {
"node": "^18 || ^20 || >= 21"
}
},
"node_modules/node-bin-setup": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/node-bin-setup/-/node-bin-setup-1.1.3.tgz",
"integrity": "sha512-opgw9iSCAzT2+6wJOETCpeRYAQxSopqQ2z+N6BXwIMsQQ7Zj5M8MaafQY8JMlolRR6R1UXg2WmhKp0p9lSOivg==",
"license": "ISC"
},
"node_modules/node-gyp-build": {
"version": "4.8.4",
"resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.4.tgz",
"integrity": "sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==",
"license": "MIT",
"bin": {
"node-gyp-build": "bin.js",
"node-gyp-build-optional": "optional.js",
"node-gyp-build-test": "build-test.js"
}
},
"node_modules/npm-run-path": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-3.1.0.tgz",
"integrity": "sha512-Dbl4A/VfiVGLgQv29URL9xshU8XDY1GeLy+fsaZ1AA8JDSfjvr5P5+pzRbWqRSBxk6/DW7MIh8lTM/PaGnP2kg==",
"dev": true,
"license": "MIT",
"dependencies": {
"path-key": "^3.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
"dev": true,
"license": "ISC",
"dependencies": {
"wrappy": "1"
}
},
"node_modules/path-key": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/prebuildify": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/prebuildify/-/prebuildify-6.0.1.tgz",
"integrity": "sha512-8Y2oOOateom/s8dNBsGIcnm6AxPmLH4/nanQzL5lQMU+sC0CMhzARZHizwr36pUPLdvBnOkCNQzxg4djuFSgIw==",
"dev": true,
"license": "MIT",
"dependencies": {
"minimist": "^1.2.5",
"mkdirp-classic": "^0.5.3",
"node-abi": "^3.3.0",
"npm-run-path": "^3.1.0",
"pump": "^3.0.0",
"tar-fs": "^2.1.0"
},
"bin": {
"prebuildify": "bin.js"
}
},
"node_modules/pump": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.2.tgz",
"integrity": "sha512-tUPXtzlGM8FE3P0ZL6DVs/3P58k9nk8/jZeQCurTJylQA8qFYzHFfhBJkuqyE0FifOsQ0uKWekiZ5g8wtr28cw==",
"dev": true,
"license": "MIT",
"dependencies": {
"end-of-stream": "^1.1.0",
"once": "^1.3.1"
}
},
"node_modules/readable-stream": {
"version": "3.6.2",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
"integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
"dev": true,
"license": "MIT",
"dependencies": {
"inherits": "^2.0.3",
"string_decoder": "^1.1.1",
"util-deprecate": "^1.0.1"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/safe-buffer": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
"dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "MIT"
},
"node_modules/semver": {
"version": "7.6.3",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz",
"integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==",
"dev": true,
"license": "ISC",
"bin": {
"semver": "bin/semver.js"
},
"engines": {
"node": ">=10"
}
},
"node_modules/string_decoder": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
"dev": true,
"license": "MIT",
"dependencies": {
"safe-buffer": "~5.2.0"
}
},
"node_modules/tar-fs": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz",
"integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==",
"dev": true,
"license": "MIT",
"dependencies": {
"chownr": "^1.1.1",
"mkdirp-classic": "^0.5.2",
"pump": "^3.0.0",
"tar-stream": "^2.1.4"
}
},
"node_modules/tar-stream": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz",
"integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"bl": "^4.0.3",
"end-of-stream": "^1.4.1",
"fs-constants": "^1.0.0",
"inherits": "^2.0.3",
"readable-stream": "^3.1.1"
},
"engines": {
"node": ">=6"
}
},
"node_modules/tree-sitter-cli": {
"version": "0.24.5",
"resolved": "https://registry.npmjs.org/tree-sitter-cli/-/tree-sitter-cli-0.24.5.tgz",
"integrity": "sha512-8EIgV/ERQlpvk1rPSCCjxveAb6Sba8tMiBpeeL68Mueuuqr0wNfhps/I1nFm2OTnpPCUV2PS9nbzzAMoyxSQUg==",
"dev": true,
"hasInstallScript": true,
"license": "MIT",
"bin": {
"tree-sitter": "cli.js"
},
"engines": {
"node": ">=12.0.0"
}
},
"node_modules/util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
"dev": true,
"license": "MIT"
},
"node_modules/wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
"dev": true,
"license": "ISC"
}
}
}

23
package.json generated
View File

@@ -1,8 +1,8 @@
{ {
"name": "tree-sitter-bruno", "name": "tree-sitter-bruno",
"version": "0.1.0", "version": "0.1.0",
"description": " Bruno grammar for tree-sitter", "description": "Bruno grammar for tree-sitter",
"repository": "github:tree-sitter/tree-sitter-bruno", "repository": "https://codeberg.org/kristoferssolo/tree-sitter-bruno",
"license": "MIT", "license": "MIT",
"author": { "author": {
"name": "Kristofers Solo", "name": "Kristofers Solo",
@@ -18,6 +18,7 @@
], ],
"files": [ "files": [
"grammar.js", "grammar.js",
"tree-sitter.json",
"binding.gyp", "binding.gyp",
"prebuilds/**", "prebuilds/**",
"bindings/node/*", "bindings/node/*",
@@ -26,16 +27,16 @@
"*.wasm" "*.wasm"
], ],
"dependencies": { "dependencies": {
"node": "^23.4.0", "node-addon-api": "^8.5.0",
"node-addon-api": "^8.1.0", "node-gyp-build": "^4.8.4"
"node-gyp-build": "^4.8.2"
}, },
"devDependencies": { "devDependencies": {
"prebuildify": "^6.0.1", "prebuildify": "^6.0.1",
"tree-sitter-cli": "^0.24.3" "tree-sitter": "^0.22.4",
"tree-sitter-cli": "^0.25.10"
}, },
"peerDependencies": { "peerDependencies": {
"tree-sitter": "^0.21.1" "tree-sitter": "^0.22.4"
}, },
"peerDependenciesMeta": { "peerDependenciesMeta": {
"tree-sitter": { "tree-sitter": {
@@ -47,11 +48,5 @@
"prestart": "tree-sitter build --wasm", "prestart": "tree-sitter build --wasm",
"start": "tree-sitter playground", "start": "tree-sitter playground",
"test": "node --test bindings/node/*_test.js" "test": "node --test bindings/node/*_test.js"
}, }
"tree-sitter": [
{
"scope": "source.bruno",
"injection-regex": "^bruno$"
}
]
} }

View File

@@ -1,11 +0,0 @@
vim.filetype.add({
extension = { bru = "bruno" },
})
require("nvim-treesitter.parsers").get_parser_configs().bruno = {
install_info = {
url = "https://github.com/kristoferssolo/tree-sitter-bruno",
files = { "src/parser.c", "src/scanner.c" },
branch = "main",
},
}

64
pyproject.toml generated
View File

@@ -1,81 +1,29 @@
[build-system] [build-system]
requires = ["setuptools>=42", "wheel"] requires = ["setuptools>=62.4.0", "wheel"]
build-backend = "setuptools.build_meta" build-backend = "setuptools.build_meta"
[project] [project]
name = "tree-sitter-bruno" name = "tree-sitter-bruno"
description = " Bruno grammar for tree-sitter" description = "Bruno grammar for tree-sitter"
version = "0.1.0" version = "0.1.0"
keywords = ["incremental", "parsing", "tree-sitter", "bruno"] keywords = ["incremental", "parsing", "tree-sitter", "bruno"]
classifiers = [ classifiers = [
"Intended Audience :: Developers", "Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Topic :: Software Development :: Compilers", "Topic :: Software Development :: Compilers",
"Topic :: Text Processing :: Linguistic", "Topic :: Text Processing :: Linguistic",
"Typing :: Typed", "Typing :: Typed",
] ]
authors = [{ name = "Kristofers Solo", email = "dev@kristofers.xyz" }] authors = [{ name = "Kristofers Solo", email = "dev@kristofers.xyz" }]
requires-python = ">=3.9" requires-python = ">=3.10"
license.text = "MIT" license.text = "MIT"
readme = "README.md" readme = "README.md"
[project.urls] [project.urls]
Homepage = "https://github.com/kristoferssolo/tree-sitter-bruno" Homepage = "https://codeberg.org/kristoferssolo/tree-sitter-bruno"
[project.optional-dependencies] [project.optional-dependencies]
core = ["tree-sitter~=0.22"] core = ["tree-sitter~=0.24"]
[tool.cibuildwheel] [tool.cibuildwheel]
build = "cp39-*" build = "cp310-*"
build-frontend = "build" build-frontend = "build"
[dependency-groups]
dev = ["ruff>=0.8.3"]
[tool.ruff]
show-fixes = true
line-length = 120
indent-width = 4
target-version = "py39"
[tool.ruff.lint]
extend-select = [
"B",
"BLE",
"C",
"C4",
"E",
"ERA",
"F",
"I",
"ICN",
"INP",
"N",
"PL",
"PGH",
"PIE",
"Q",
"RET",
"RSE",
"RUF",
"S",
"SIM",
"T20",
"TCH",
"TID",
"PT",
"UP",
"DJ",
"W",
]
ignore = []
preview = true
fixable = ["ALL"]
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "lf"
docstring-code-format = true
docstring-code-line-length = 40

View File

@@ -1,3 +0,0 @@
(dictionary) @fold
(array) @fold
(textblock) @fold

View File

@@ -1,17 +0,0 @@
(keyword) @keyword
[
"{"
"}"
"["
"]"
] @punctuation.bracket
":" @punctuation.delimiter
(key) @type
[
(value)
(array_value)
] @string
(ERROR) @error

View File

@@ -1,10 +0,0 @@
(dictionary) @indent.begin
(dictionary
"}" @indent.end)
"}" @indent.branch
(textblock) @indent.begin
(textblock
"}" @indent.end)
"}" @indent.branch

View File

@@ -1,59 +0,0 @@
((body
(keyword)
(textblock
(rawtext) @injection.content))
(#set! injection.language "json"))
((bodyjson
(keyword)
(textblock
(rawtext) @injection.content))
(#set! injection.language "json"))
((bodyxml
(keyword)
(textblock
(rawtext) @injection.content))
(#set! injection.language "xml"))
((bodysparql
(keyword)
(textblock
(rawtext) @injection.content))
(#set! injection.language "sparql"))
((bodygraphql
(keyword)
(textblock
(rawtext) @injection.content))
(#set! injection.language "graphql"))
((bodygraphqlvars
(keyword)
(textblock
(rawtext) @injection.content))
(#set! injection.language "json"))
((scriptres
(keyword)
(textblock
(rawtext) @injection.content))
(#set! injection.language "javascript"))
((scriptreq
(keyword)
(textblock
(rawtext) @injection.content))
(#set! injection.language "javascript"))
((tests
(keyword)
(textblock
(rawtext) @injection.content))
(#set! injection.language "javascript"))
((docs
(keyword)
(textblock
(rawtext) @injection.content))
(#set! injection.language "markdown"))

View File

@@ -1,12 +0,0 @@
(source_file) @tag.root
(meta) @tag.meta
(http) @tag.http
(query) @tag.query
(headers) @tag.headers
(auths) @tag.auths
(bodies) @tag.bodies
(varsandassert) @tag.varsandassert
(script) @tag.script
(tests) @tag.tests
(docs) @tag.docs

6
queries/folds.scm Normal file
View File

@@ -0,0 +1,6 @@
[
(object_block)
(assert_block)
(array_block)
(textblock)
] @fold

8
queries/highlights.scm Normal file
View File

@@ -0,0 +1,8 @@
(keyword) @keyword
(key) @property
(assert_key) @property
(quoted_value) @string
(template_value) @variable.special
(bare_value) @string.unquoted

11
queries/indents.scm Normal file
View File

@@ -0,0 +1,11 @@
[
(object_block)
(assert_block)
(array_block)
(textblock)
] @indent.begin
[
"}"
"]"
] @indent.end

59
queries/injections.scm Normal file
View File

@@ -0,0 +1,59 @@
((bodyraw
(keyword)
(textblock
(rawtext) @injection.content))
(#set! injection.language "json"))
((bodyjson
(keyword)
(textblock
(rawtext) @injection.content))
(#set! injection.language "json"))
((bodygraphql
(keyword)
(textblock
(rawtext) @injection.content))
(#set! injection.language "graphql"))
((bodygraphqlvars
(keyword)
(textblock
(rawtext) @injection.content))
(#set! injection.language "json"))
((bodyxml
(keyword)
(textblock
(rawtext) @injection.content))
(#set! injection.language "xml"))
((bodysparql
(keyword)
(textblock
(rawtext) @injection.content))
(#set! injection.language "sparql"))
((scriptreq
(keyword)
(textblock
(rawtext) @injection.content))
(#set! injection.language "javascript"))
((scriptres
(keyword)
(textblock
(rawtext) @injection.content))
(#set! injection.language "javascript"))
((tests
(keyword)
(textblock
(rawtext) @injection.content))
(#set! injection.language "javascript"))
((docs
(keyword)
(textblock
(rawtext) @injection.content))
(#set! injection.language "markdown"))

77
queries/tags.scm Normal file
View File

@@ -0,0 +1,77 @@
((meta
(keyword) @name) @definition.module)
((http
(keyword) @name) @definition.module)
((query
(keyword) @name) @definition.module)
((headers
(keyword) @name) @definition.module)
((authawsv4
(keyword) @name) @definition.module)
((authbasic
(keyword) @name) @definition.module)
((authbearer
(keyword) @name) @definition.module)
((authdigest
(keyword) @name) @definition.module)
((authoauth2
(keyword) @name) @definition.module)
((bodyraw
(keyword) @name) @definition.module)
((bodyjson
(keyword) @name) @definition.module)
((bodytext
(keyword) @name) @definition.module)
((bodyxml
(keyword) @name) @definition.module)
((bodysparql
(keyword) @name) @definition.module)
((bodygraphql
(keyword) @name) @definition.module)
((bodygraphqlvars
(keyword) @name) @definition.module)
((vars_plain
(keyword) @name) @definition.module)
((varsreq
(keyword) @name) @definition.module)
((varsres
(keyword) @name) @definition.module)
((params_query
(keyword) @name) @definition.module)
((params_path
(keyword) @name) @definition.module)
((assert
(keyword) @name) @definition.module)
((scriptreq
(keyword) @name) @definition.module)
((scriptres
(keyword) @name) @definition.module)
((tests
(keyword) @name) @definition.module)
((docs
(keyword) @name) @definition.module)

54
setup.py generated
View File

@@ -1,27 +1,49 @@
from os.path import isdir, join from os import path
from platform import system from sysconfig import get_config_var
from setuptools import Extension, find_packages, setup from setuptools import Extension, find_packages, setup
from setuptools.command.build import build from setuptools.command.build import build
from setuptools.command.build_ext import build_ext
from setuptools.command.egg_info import egg_info
from wheel.bdist_wheel import bdist_wheel from wheel.bdist_wheel import bdist_wheel
class Build(build): class Build(build):
def run(self): def run(self):
if isdir("queries"): if path.isdir("queries"):
dest = join(self.build_lib, "tree_sitter_bruno", "queries") dest = path.join(self.build_lib, "tree_sitter_bruno", "queries")
self.copy_tree("queries", dest) self.copy_tree("queries", dest)
super().run() super().run()
class BuildExt(build_ext):
def build_extension(self, ext: Extension):
if self.compiler.compiler_type != "msvc":
ext.extra_compile_args = ["-std=c11", "-fvisibility=hidden"]
else:
ext.extra_compile_args = ["/std:c11", "/utf-8"]
if path.exists("src/scanner.c"):
ext.sources.append("src/scanner.c")
if ext.py_limited_api:
ext.define_macros.append(("Py_LIMITED_API", "0x030A0000"))
super().build_extension(ext)
class BdistWheel(bdist_wheel): class BdistWheel(bdist_wheel):
def get_tag(self): def get_tag(self):
python, abi, platform = super().get_tag() python, abi, platform = super().get_tag()
if python.startswith("cp"): if python.startswith("cp"):
python, abi = "cp39", "abi3" python, abi = "cp310", "abi3"
return python, abi, platform return python, abi, platform
class EggInfo(egg_info):
def find_sources(self):
super().find_sources()
self.filelist.recursive_include("queries", "*.scm")
self.filelist.include("src/tree_sitter/*.h")
setup( setup(
packages=find_packages("bindings/python"), packages=find_packages("bindings/python"),
package_dir={"": "bindings/python"}, package_dir={"": "bindings/python"},
@@ -36,26 +58,20 @@ setup(
sources=[ sources=[
"bindings/python/tree_sitter_bruno/binding.c", "bindings/python/tree_sitter_bruno/binding.c",
"src/parser.c", "src/parser.c",
"src/scanner.c",
],
extra_compile_args=[
"-std=c11",
"-fvisibility=hidden",
]
if system() != "Windows"
else [
"/std:c11",
"/utf-8",
], ],
define_macros=[ define_macros=[
("Py_LIMITED_API", "0x03090000"),
("PY_SSIZE_T_CLEAN", None), ("PY_SSIZE_T_CLEAN", None),
("TREE_SITTER_HIDE_SYMBOLS", None), ("TREE_SITTER_HIDE_SYMBOLS", None),
], ],
include_dirs=["src"], include_dirs=["src"],
py_limited_api=True, py_limited_api=not get_config_var("Py_GIL_DISABLED"),
) )
], ],
cmdclass={"build": Build, "bdist_wheel": BdistWheel}, cmdclass={
zip_safe=False, "build": Build,
"build_ext": BuildExt,
"bdist_wheel": BdistWheel,
"egg_info": EggInfo,
},
zip_safe=False
) )

428
src/grammar.json generated
View File

@@ -5,55 +5,63 @@
"source_file": { "source_file": {
"type": "REPEAT", "type": "REPEAT",
"content": { "content": {
"type": "FIELD", "type": "SYMBOL",
"name": "tag", "name": "section"
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "meta"
},
{
"type": "SYMBOL",
"name": "http"
},
{
"type": "SYMBOL",
"name": "query"
},
{
"type": "SYMBOL",
"name": "headers"
},
{
"type": "SYMBOL",
"name": "auths"
},
{
"type": "SYMBOL",
"name": "bodies"
},
{
"type": "SYMBOL",
"name": "varsandassert"
},
{
"type": "SYMBOL",
"name": "script"
},
{
"type": "SYMBOL",
"name": "tests"
},
{
"type": "SYMBOL",
"name": "docs"
}
]
}
} }
}, },
"section": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "meta"
},
{
"type": "SYMBOL",
"name": "http"
},
{
"type": "SYMBOL",
"name": "query"
},
{
"type": "SYMBOL",
"name": "headers"
},
{
"type": "SYMBOL",
"name": "auth"
},
{
"type": "SYMBOL",
"name": "body"
},
{
"type": "SYMBOL",
"name": "vars"
},
{
"type": "SYMBOL",
"name": "assert"
},
{
"type": "SYMBOL",
"name": "params"
},
{
"type": "SYMBOL",
"name": "script"
},
{
"type": "SYMBOL",
"name": "tests"
},
{
"type": "SYMBOL",
"name": "docs"
}
]
},
"meta": { "meta": {
"type": "SEQ", "type": "SEQ",
"members": [ "members": [
@@ -68,7 +76,7 @@
}, },
{ {
"type": "SYMBOL", "type": "SYMBOL",
"name": "dictionary" "name": "object_block"
} }
] ]
}, },
@@ -86,7 +94,7 @@
}, },
{ {
"type": "SYMBOL", "type": "SYMBOL",
"name": "dictionary" "name": "object_block"
} }
] ]
}, },
@@ -145,7 +153,7 @@
}, },
{ {
"type": "SYMBOL", "type": "SYMBOL",
"name": "dictionary" "name": "object_block"
} }
] ]
}, },
@@ -163,11 +171,11 @@
}, },
{ {
"type": "SYMBOL", "type": "SYMBOL",
"name": "dictionary" "name": "object_block"
} }
] ]
}, },
"auths": { "auth": {
"type": "CHOICE", "type": "CHOICE",
"members": [ "members": [
{ {
@@ -206,7 +214,7 @@
}, },
{ {
"type": "SYMBOL", "type": "SYMBOL",
"name": "dictionary" "name": "object_block"
} }
] ]
}, },
@@ -224,7 +232,7 @@
}, },
{ {
"type": "SYMBOL", "type": "SYMBOL",
"name": "dictionary" "name": "object_block"
} }
] ]
}, },
@@ -242,7 +250,7 @@
}, },
{ {
"type": "SYMBOL", "type": "SYMBOL",
"name": "dictionary" "name": "object_block"
} }
] ]
}, },
@@ -260,7 +268,7 @@
}, },
{ {
"type": "SYMBOL", "type": "SYMBOL",
"name": "dictionary" "name": "object_block"
} }
] ]
}, },
@@ -278,11 +286,11 @@
}, },
{ {
"type": "SYMBOL", "type": "SYMBOL",
"name": "dictionary" "name": "object_block"
} }
] ]
}, },
"bodies": { "body": {
"type": "CHOICE", "type": "CHOICE",
"members": [ "members": [
{ {
@@ -309,19 +317,6 @@
"type": "SYMBOL", "type": "SYMBOL",
"name": "bodygraphqlvars" "name": "bodygraphqlvars"
}, },
{
"type": "SYMBOL",
"name": "bodyforms"
},
{
"type": "SYMBOL",
"name": "body"
}
]
},
"bodyforms": {
"type": "CHOICE",
"members": [
{ {
"type": "SYMBOL", "type": "SYMBOL",
"name": "bodyformurlencoded" "name": "bodyformurlencoded"
@@ -329,10 +324,14 @@
{ {
"type": "SYMBOL", "type": "SYMBOL",
"name": "bodyformmultipart" "name": "bodyformmultipart"
},
{
"type": "SYMBOL",
"name": "bodyraw"
} }
] ]
}, },
"body": { "bodyraw": {
"type": "SEQ", "type": "SEQ",
"members": [ "members": [
{ {
@@ -472,7 +471,7 @@
}, },
{ {
"type": "SYMBOL", "type": "SYMBOL",
"name": "dictionary" "name": "object_block"
} }
] ]
}, },
@@ -490,16 +489,16 @@
}, },
{ {
"type": "SYMBOL", "type": "SYMBOL",
"name": "dictionary" "name": "object_block"
} }
] ]
}, },
"varsandassert": { "vars": {
"type": "CHOICE", "type": "CHOICE",
"members": [ "members": [
{ {
"type": "SYMBOL", "type": "SYMBOL",
"name": "vars" "name": "vars_plain"
}, },
{ {
"type": "SYMBOL", "type": "SYMBOL",
@@ -512,18 +511,10 @@
{ {
"type": "SYMBOL", "type": "SYMBOL",
"name": "varsres" "name": "varsres"
},
{
"type": "SYMBOL",
"name": "assert"
},
{
"type": "SYMBOL",
"name": "params"
} }
] ]
}, },
"vars": { "vars_plain": {
"type": "SEQ", "type": "SEQ",
"members": [ "members": [
{ {
@@ -537,7 +528,7 @@
}, },
{ {
"type": "SYMBOL", "type": "SYMBOL",
"name": "dictionary" "name": "object_block"
} }
] ]
}, },
@@ -555,7 +546,7 @@
}, },
{ {
"type": "SYMBOL", "type": "SYMBOL",
"name": "array" "name": "array_block"
} }
] ]
}, },
@@ -573,7 +564,7 @@
}, },
{ {
"type": "SYMBOL", "type": "SYMBOL",
"name": "dictionary" "name": "object_block"
} }
] ]
}, },
@@ -591,7 +582,7 @@
}, },
{ {
"type": "SYMBOL", "type": "SYMBOL",
"name": "dictionary" "name": "object_block"
} }
] ]
}, },
@@ -609,7 +600,7 @@
}, },
{ {
"type": "SYMBOL", "type": "SYMBOL",
"name": "assert_dictionary" "name": "assert_block"
} }
] ]
}, },
@@ -689,7 +680,7 @@
}, },
{ {
"type": "SYMBOL", "type": "SYMBOL",
"name": "dictionary" "name": "object_block"
} }
] ]
}, },
@@ -707,7 +698,7 @@
}, },
{ {
"type": "SYMBOL", "type": "SYMBOL",
"name": "dictionary" "name": "object_block"
} }
] ]
}, },
@@ -747,7 +738,7 @@
} }
] ]
}, },
"textblock": { "object_block": {
"type": "SEQ", "type": "SEQ",
"members": [ "members": [
{ {
@@ -755,16 +746,11 @@
"value": "{" "value": "{"
}, },
{ {
"type": "CHOICE", "type": "REPEAT",
"members": [ "content": {
{ "type": "SYMBOL",
"type": "SYMBOL", "name": "dictionary_pair"
"name": "rawtext" }
},
{
"type": "BLANK"
}
]
}, },
{ {
"type": "STRING", "type": "STRING",
@@ -772,7 +758,78 @@
} }
] ]
}, },
"array": { "dictionary_pair": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "key"
},
{
"type": "STRING",
"value": ":"
},
{
"type": "SYMBOL",
"name": "dictionary_value"
}
]
},
"dictionary_value": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "template_value"
},
{
"type": "SYMBOL",
"name": "quoted_value"
},
{
"type": "SYMBOL",
"name": "bare_value"
}
]
},
"assert_block": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "{"
},
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "assert_dictionary_pair"
}
},
{
"type": "STRING",
"value": "}"
}
]
},
"assert_dictionary_pair": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "assert_key"
},
{
"type": "STRING",
"value": ":"
},
{
"type": "SYMBOL",
"name": "dictionary_value"
}
]
},
"array_block": {
"type": "SEQ", "type": "SEQ",
"members": [ "members": [
{ {
@@ -810,10 +867,23 @@
] ]
}, },
"array_value": { "array_value": {
"type": "PATTERN", "type": "CHOICE",
"value": "[^\\r\\n\\s\\t\\[\\],]+" "members": [
{
"type": "SYMBOL",
"name": "template_value"
},
{
"type": "SYMBOL",
"name": "quoted_value"
},
{
"type": "SYMBOL",
"name": "bare_value"
}
]
}, },
"dictionary": { "textblock": {
"type": "SEQ", "type": "SEQ",
"members": [ "members": [
{ {
@@ -821,11 +891,16 @@
"value": "{" "value": "{"
}, },
{ {
"type": "REPEAT", "type": "CHOICE",
"content": { "members": [
"type": "SYMBOL", {
"name": "dictionary_pair" "type": "SYMBOL",
} "name": "rawtext"
},
{
"type": "BLANK"
}
]
}, },
{ {
"type": "STRING", "type": "STRING",
@@ -833,60 +908,6 @@
} }
] ]
}, },
"dictionary_pair": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "key"
},
{
"type": "STRING",
"value": ":"
},
{
"type": "SYMBOL",
"name": "value"
}
]
},
"assert_dictionary": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "{"
},
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "assert_dictionary_pair"
}
},
{
"type": "STRING",
"value": "}"
}
]
},
"assert_dictionary_pair": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "assert_key"
},
{
"type": "STRING",
"value": ":"
},
{
"type": "SYMBOL",
"name": "value"
}
]
},
"assert_key": { "assert_key": {
"type": "PATTERN", "type": "PATTERN",
"value": "[^\\r\\n:]+" "value": "[^\\r\\n:]+"
@@ -895,15 +916,79 @@
"type": "PATTERN", "type": "PATTERN",
"value": "[^\\s\\r\\n:]+" "value": "[^\\s\\r\\n:]+"
}, },
"value": { "bare_value": {
"type": "PATTERN", "type": "PATTERN",
"value": "[^\\r\\n]*" "value": "[^\\s\\r\\n\",\\]}][^\\r\\n]*"
},
"quoted_value": {
"type": "TOKEN",
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "\""
},
{
"type": "REPEAT",
"content": {
"type": "CHOICE",
"members": [
{
"type": "PATTERN",
"value": "[^\"\\\\]+"
},
{
"type": "PATTERN",
"value": "\\\\."
}
]
}
},
{
"type": "STRING",
"value": "\""
}
]
}
},
"template_value": {
"type": "TOKEN",
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "{{"
},
{
"type": "REPEAT",
"content": {
"type": "CHOICE",
"members": [
{
"type": "PATTERN",
"value": "[^}]+"
},
{
"type": "PATTERN",
"value": "}[^}]"
}
]
}
},
{
"type": "STRING",
"value": "}}"
}
]
}
} }
}, },
"extras": [ "extras": [
{ {
"type": "PATTERN", "type": "PATTERN",
"value": "\\s+|(\\r?\\n)" "value": "\\s"
} }
], ],
"conflicts": [], "conflicts": [],
@@ -915,5 +1000,6 @@
} }
], ],
"inline": [], "inline": [],
"supertypes": [] "supertypes": [],
} "reserved": {}
}

603
src/node-types.json generated
View File

@@ -1,6 +1,6 @@
[ [
{ {
"type": "array", "type": "array_block",
"named": true, "named": true,
"fields": {}, "fields": {},
"children": { "children": {
@@ -14,6 +14,29 @@
] ]
} }
}, },
{
"type": "array_value",
"named": true,
"fields": {},
"children": {
"multiple": false,
"required": true,
"types": [
{
"type": "bare_value",
"named": true
},
{
"type": "quoted_value",
"named": true
},
{
"type": "template_value",
"named": true
}
]
}
},
{ {
"type": "assert", "type": "assert",
"named": true, "named": true,
@@ -23,7 +46,7 @@
"required": true, "required": true,
"types": [ "types": [
{ {
"type": "assert_dictionary", "type": "assert_block",
"named": true "named": true
}, },
{ {
@@ -34,7 +57,7 @@
} }
}, },
{ {
"type": "assert_dictionary", "type": "assert_block",
"named": true, "named": true,
"fields": {}, "fields": {},
"children": { "children": {
@@ -61,109 +84,14 @@
"named": true "named": true
}, },
{ {
"type": "value", "type": "dictionary_value",
"named": true "named": true
} }
] ]
} }
}, },
{ {
"type": "authawsv4", "type": "auth",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "dictionary",
"named": true
},
{
"type": "keyword",
"named": true
}
]
}
},
{
"type": "authbasic",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "dictionary",
"named": true
},
{
"type": "keyword",
"named": true
}
]
}
},
{
"type": "authbearer",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "dictionary",
"named": true
},
{
"type": "keyword",
"named": true
}
]
}
},
{
"type": "authdigest",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "dictionary",
"named": true
},
{
"type": "keyword",
"named": true
}
]
}
},
{
"type": "authoauth2",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "dictionary",
"named": true
},
{
"type": "keyword",
"named": true
}
]
}
},
{
"type": "auths",
"named": true, "named": true,
"fields": {}, "fields": {},
"children": { "children": {
@@ -194,7 +122,102 @@
} }
}, },
{ {
"type": "bodies", "type": "authawsv4",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "keyword",
"named": true
},
{
"type": "object_block",
"named": true
}
]
}
},
{
"type": "authbasic",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "keyword",
"named": true
},
{
"type": "object_block",
"named": true
}
]
}
},
{
"type": "authbearer",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "keyword",
"named": true
},
{
"type": "object_block",
"named": true
}
]
}
},
{
"type": "authdigest",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "keyword",
"named": true
},
{
"type": "object_block",
"named": true
}
]
}
},
{
"type": "authoauth2",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "keyword",
"named": true
},
{
"type": "object_block",
"named": true
}
]
}
},
{
"type": "body",
"named": true, "named": true,
"fields": {}, "fields": {},
"children": { "children": {
@@ -202,11 +225,11 @@
"required": true, "required": true,
"types": [ "types": [
{ {
"type": "body", "type": "bodyformmultipart",
"named": true "named": true
}, },
{ {
"type": "bodyforms", "type": "bodyformurlencoded",
"named": true "named": true
}, },
{ {
@@ -221,6 +244,10 @@
"type": "bodyjson", "type": "bodyjson",
"named": true "named": true
}, },
{
"type": "bodyraw",
"named": true
},
{ {
"type": "bodysparql", "type": "bodysparql",
"named": true "named": true
@@ -236,25 +263,6 @@
] ]
} }
}, },
{
"type": "body",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "keyword",
"named": true
},
{
"type": "textblock",
"named": true
}
]
}
},
{ {
"type": "bodyformmultipart", "type": "bodyformmultipart",
"named": true, "named": true,
@@ -263,31 +271,12 @@
"multiple": true, "multiple": true,
"required": true, "required": true,
"types": [ "types": [
{
"type": "dictionary",
"named": true
},
{ {
"type": "keyword", "type": "keyword",
"named": true "named": true
}
]
}
},
{
"type": "bodyforms",
"named": true,
"fields": {},
"children": {
"multiple": false,
"required": true,
"types": [
{
"type": "bodyformmultipart",
"named": true
}, },
{ {
"type": "bodyformurlencoded", "type": "object_block",
"named": true "named": true
} }
] ]
@@ -302,11 +291,11 @@
"required": true, "required": true,
"types": [ "types": [
{ {
"type": "dictionary", "type": "keyword",
"named": true "named": true
}, },
{ {
"type": "keyword", "type": "object_block",
"named": true "named": true
} }
] ]
@@ -369,6 +358,25 @@
] ]
} }
}, },
{
"type": "bodyraw",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "keyword",
"named": true
},
{
"type": "textblock",
"named": true
}
]
}
},
{ {
"type": "bodysparql", "type": "bodysparql",
"named": true, "named": true,
@@ -426,21 +434,6 @@
] ]
} }
}, },
{
"type": "dictionary",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": false,
"types": [
{
"type": "dictionary_pair",
"named": true
}
]
}
},
{ {
"type": "dictionary_pair", "type": "dictionary_pair",
"named": true, "named": true,
@@ -450,11 +443,34 @@
"required": true, "required": true,
"types": [ "types": [
{ {
"type": "key", "type": "dictionary_value",
"named": true "named": true
}, },
{ {
"type": "value", "type": "key",
"named": true
}
]
}
},
{
"type": "dictionary_value",
"named": true,
"fields": {},
"children": {
"multiple": false,
"required": true,
"types": [
{
"type": "bare_value",
"named": true
},
{
"type": "quoted_value",
"named": true
},
{
"type": "template_value",
"named": true "named": true
} }
] ]
@@ -488,11 +504,11 @@
"required": true, "required": true,
"types": [ "types": [
{ {
"type": "dictionary", "type": "keyword",
"named": true "named": true
}, },
{ {
"type": "keyword", "type": "object_block",
"named": true "named": true
} }
] ]
@@ -507,11 +523,11 @@
"required": true, "required": true,
"types": [ "types": [
{ {
"type": "dictionary", "type": "keyword",
"named": true "named": true
}, },
{ {
"type": "keyword", "type": "object_block",
"named": true "named": true
} }
] ]
@@ -531,11 +547,26 @@
"required": true, "required": true,
"types": [ "types": [
{ {
"type": "dictionary", "type": "keyword",
"named": true "named": true
}, },
{ {
"type": "keyword", "type": "object_block",
"named": true
}
]
}
},
{
"type": "object_block",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": false,
"types": [
{
"type": "dictionary_pair",
"named": true "named": true
} }
] ]
@@ -569,11 +600,11 @@
"required": true, "required": true,
"types": [ "types": [
{ {
"type": "dictionary", "type": "keyword",
"named": true "named": true
}, },
{ {
"type": "keyword", "type": "object_block",
"named": true "named": true
} }
] ]
@@ -588,11 +619,11 @@
"required": true, "required": true,
"types": [ "types": [
{ {
"type": "dictionary", "type": "keyword",
"named": true "named": true
}, },
{ {
"type": "keyword", "type": "object_block",
"named": true "named": true
} }
] ]
@@ -607,11 +638,11 @@
"required": true, "required": true,
"types": [ "types": [
{ {
"type": "dictionary", "type": "keyword",
"named": true "named": true
}, },
{ {
"type": "keyword", "type": "object_block",
"named": true "named": true
} }
] ]
@@ -674,57 +705,79 @@
] ]
} }
}, },
{
"type": "section",
"named": true,
"fields": {},
"children": {
"multiple": false,
"required": true,
"types": [
{
"type": "assert",
"named": true
},
{
"type": "auth",
"named": true
},
{
"type": "body",
"named": true
},
{
"type": "docs",
"named": true
},
{
"type": "headers",
"named": true
},
{
"type": "http",
"named": true
},
{
"type": "meta",
"named": true
},
{
"type": "params",
"named": true
},
{
"type": "query",
"named": true
},
{
"type": "script",
"named": true
},
{
"type": "tests",
"named": true
},
{
"type": "vars",
"named": true
}
]
}
},
{ {
"type": "source_file", "type": "source_file",
"named": true, "named": true,
"root": true, "root": true,
"fields": { "fields": {},
"tag": { "children": {
"multiple": true, "multiple": true,
"required": false, "required": false,
"types": [ "types": [
{ {
"type": "auths", "type": "section",
"named": true "named": true
}, }
{ ]
"type": "bodies",
"named": true
},
{
"type": "docs",
"named": true
},
{
"type": "headers",
"named": true
},
{
"type": "http",
"named": true
},
{
"type": "meta",
"named": true
},
{
"type": "query",
"named": true
},
{
"type": "script",
"named": true
},
{
"type": "tests",
"named": true
},
{
"type": "varsandassert",
"named": true
}
]
}
} }
}, },
{ {
@@ -765,58 +818,12 @@
"type": "vars", "type": "vars",
"named": true, "named": true,
"fields": {}, "fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "dictionary",
"named": true
},
{
"type": "keyword",
"named": true
}
]
}
},
{
"type": "vars_secret",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "array",
"named": true
},
{
"type": "keyword",
"named": true
}
]
}
},
{
"type": "varsandassert",
"named": true,
"fields": {},
"children": { "children": {
"multiple": false, "multiple": false,
"required": true, "required": true,
"types": [ "types": [
{ {
"type": "assert", "type": "vars_plain",
"named": true
},
{
"type": "params",
"named": true
},
{
"type": "vars",
"named": true "named": true
}, },
{ {
@@ -834,6 +841,44 @@
] ]
} }
}, },
{
"type": "vars_plain",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "keyword",
"named": true
},
{
"type": "object_block",
"named": true
}
]
}
},
{
"type": "vars_secret",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "array_block",
"named": true
},
{
"type": "keyword",
"named": true
}
]
}
},
{ {
"type": "varsreq", "type": "varsreq",
"named": true, "named": true,
@@ -843,11 +888,11 @@
"required": true, "required": true,
"types": [ "types": [
{ {
"type": "dictionary", "type": "keyword",
"named": true "named": true
}, },
{ {
"type": "keyword", "type": "object_block",
"named": true "named": true
} }
] ]
@@ -862,11 +907,11 @@
"required": true, "required": true,
"types": [ "types": [
{ {
"type": "dictionary", "type": "keyword",
"named": true "named": true
}, },
{ {
"type": "keyword", "type": "object_block",
"named": true "named": true
} }
] ]
@@ -889,11 +934,11 @@
"named": false "named": false
}, },
{ {
"type": "array_value", "type": "assert_key",
"named": true "named": true
}, },
{ {
"type": "assert_key", "type": "bare_value",
"named": true "named": true
}, },
{ {
@@ -932,18 +977,22 @@
"type": "put", "type": "put",
"named": false "named": false
}, },
{
"type": "quoted_value",
"named": true
},
{ {
"type": "rawtext", "type": "rawtext",
"named": true "named": true
}, },
{
"type": "template_value",
"named": true
},
{ {
"type": "trace", "type": "trace",
"named": false "named": false
}, },
{
"type": "value",
"named": true
},
{ {
"type": "{", "type": "{",
"named": false "named": false

2322
src/parser.c generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,50 +1,98 @@
#include "tree_sitter/parser.h" #include "tree_sitter/parser.h"
#include <stdbool.h>
#include <stdint.h>
enum TokenType { enum TokenType {
RAW_TEXT, RAWTEXT,
}; };
void *tree_sitter_bruno_external_scanner_create() { void *tree_sitter_bruno_external_scanner_create(void) {
return NULL; return NULL;
} }
void tree_sitter_bruno_external_scanner_destroy(void *p) { void tree_sitter_bruno_external_scanner_destroy(void *payload) {
(void)payload;
} }
void tree_sitter_bruno_external_scanner_reset(void *p) { unsigned tree_sitter_bruno_external_scanner_serialize(void *payload, char *buffer) {
} (void)payload;
(void)buffer;
unsigned tree_sitter_bruno_external_scanner_serialize(void *p, char *buffer) {
return 0; return 0;
} }
void tree_sitter_bruno_external_scanner_deserialize(void *p, const char *b, unsigned n) { void tree_sitter_bruno_external_scanner_deserialize(void *payload, const char *buffer, unsigned length) {
(void)payload;
(void)buffer;
(void)length;
} }
static void advance(TSLexer *lexer) { static void advance(TSLexer *lexer) {
lexer->advance(lexer, false); lexer->advance(lexer, false);
} }
bool tree_sitter_bruno_external_scanner_scan(void *payload, TSLexer *lexer, const bool *valid_symbols) { static void skip(TSLexer *lexer) {
if (valid_symbols[RAW_TEXT]) { lexer->advance(lexer, true);
// Scanning raw text follows the rules of the official Bruno language grammar }
// (refer to https://github.com/usebruno/bruno/blob/main/packages/bruno-lang/v2/src/bruToJson.js).
// A raw text block ends if a closing angle bracket is found right after a newline.
lexer->result_symbol = RAW_TEXT; static bool scan_quoted(TSLexer *lexer, int32_t quote) {
for (bool has_content = false;; has_content = true) { advance(lexer);
lexer->mark_end(lexer);
switch (lexer->lookahead) { while (lexer->lookahead) {
case '\n': if (lexer->lookahead == '\\') {
advance(lexer); advance(lexer);
if (lexer->lookahead == '}') return has_content; if (lexer->lookahead) advance(lexer);
break; continue;
case '\0': return false;
default: advance(lexer);
}
} }
if (lexer->lookahead == quote) {
advance(lexer);
return true;
}
advance(lexer);
} }
return false; return false;
} }
bool tree_sitter_bruno_external_scanner_scan(void *payload, TSLexer *lexer, const bool *valid_symbols) {
(void)payload;
if (!valid_symbols[RAWTEXT]) return false;
if (lexer->lookahead == '}') return false;
unsigned depth = 0;
bool has_content = false;
while (lexer->lookahead) {
if (lexer->lookahead == '\'' || lexer->lookahead == '"' || lexer->lookahead == '`') {
has_content = true;
if (!scan_quoted(lexer, lexer->lookahead)) break;
continue;
}
if (lexer->lookahead == '{') {
has_content = true;
depth++;
advance(lexer);
continue;
}
if (lexer->lookahead == '}') {
if (depth == 0) break;
depth--;
has_content = true;
advance(lexer);
continue;
}
has_content = true;
advance(lexer);
}
if (!has_content) return false;
lexer->result_symbol = RAWTEXT;
return true;
}

View File

@@ -14,6 +14,7 @@ extern "C" {
#include <string.h> #include <string.h>
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4101) #pragma warning(disable : 4101)
#elif defined(__GNUC__) || defined(__clang__) #elif defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push #pragma GCC diagnostic push
@@ -278,7 +279,7 @@ static inline void _array__splice(Array *self, size_t element_size,
#define _compare_int(a, b) ((int)*(a) - (int)(b)) #define _compare_int(a, b) ((int)*(a) - (int)(b))
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(default : 4101) #pragma warning(pop)
#elif defined(__GNUC__) || defined(__clang__) #elif defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif #endif

View File

@@ -18,6 +18,11 @@ typedef uint16_t TSStateId;
typedef uint16_t TSSymbol; typedef uint16_t TSSymbol;
typedef uint16_t TSFieldId; typedef uint16_t TSFieldId;
typedef struct TSLanguage TSLanguage; typedef struct TSLanguage TSLanguage;
typedef struct TSLanguageMetadata {
uint8_t major_version;
uint8_t minor_version;
uint8_t patch_version;
} TSLanguageMetadata;
#endif #endif
typedef struct { typedef struct {
@@ -26,10 +31,11 @@ typedef struct {
bool inherited; bool inherited;
} TSFieldMapEntry; } TSFieldMapEntry;
// Used to index the field and supertype maps.
typedef struct { typedef struct {
uint16_t index; uint16_t index;
uint16_t length; uint16_t length;
} TSFieldMapSlice; } TSMapSlice;
typedef struct { typedef struct {
bool visible; bool visible;
@@ -79,6 +85,12 @@ typedef struct {
uint16_t external_lex_state; uint16_t external_lex_state;
} TSLexMode; } TSLexMode;
typedef struct {
uint16_t lex_state;
uint16_t external_lex_state;
uint16_t reserved_word_set_id;
} TSLexerMode;
typedef union { typedef union {
TSParseAction action; TSParseAction action;
struct { struct {
@@ -93,7 +105,7 @@ typedef struct {
} TSCharacterRange; } TSCharacterRange;
struct TSLanguage { struct TSLanguage {
uint32_t version; uint32_t abi_version;
uint32_t symbol_count; uint32_t symbol_count;
uint32_t alias_count; uint32_t alias_count;
uint32_t token_count; uint32_t token_count;
@@ -109,13 +121,13 @@ struct TSLanguage {
const TSParseActionEntry *parse_actions; const TSParseActionEntry *parse_actions;
const char * const *symbol_names; const char * const *symbol_names;
const char * const *field_names; const char * const *field_names;
const TSFieldMapSlice *field_map_slices; const TSMapSlice *field_map_slices;
const TSFieldMapEntry *field_map_entries; const TSFieldMapEntry *field_map_entries;
const TSSymbolMetadata *symbol_metadata; const TSSymbolMetadata *symbol_metadata;
const TSSymbol *public_symbol_map; const TSSymbol *public_symbol_map;
const uint16_t *alias_map; const uint16_t *alias_map;
const TSSymbol *alias_sequences; const TSSymbol *alias_sequences;
const TSLexMode *lex_modes; const TSLexerMode *lex_modes;
bool (*lex_fn)(TSLexer *, TSStateId); bool (*lex_fn)(TSLexer *, TSStateId);
bool (*keyword_lex_fn)(TSLexer *, TSStateId); bool (*keyword_lex_fn)(TSLexer *, TSStateId);
TSSymbol keyword_capture_token; TSSymbol keyword_capture_token;
@@ -129,15 +141,23 @@ struct TSLanguage {
void (*deserialize)(void *, const char *, unsigned); void (*deserialize)(void *, const char *, unsigned);
} external_scanner; } external_scanner;
const TSStateId *primary_state_ids; const TSStateId *primary_state_ids;
const char *name;
const TSSymbol *reserved_words;
uint16_t max_reserved_word_set_size;
uint32_t supertype_count;
const TSSymbol *supertype_symbols;
const TSMapSlice *supertype_map_slices;
const TSSymbol *supertype_map_entries;
TSLanguageMetadata metadata;
}; };
static inline bool set_contains(TSCharacterRange *ranges, uint32_t len, int32_t lookahead) { static inline bool set_contains(const TSCharacterRange *ranges, uint32_t len, int32_t lookahead) {
uint32_t index = 0; uint32_t index = 0;
uint32_t size = len - index; uint32_t size = len - index;
while (size > 1) { while (size > 1) {
uint32_t half_size = size / 2; uint32_t half_size = size / 2;
uint32_t mid_index = index + half_size; uint32_t mid_index = index + half_size;
TSCharacterRange *range = &ranges[mid_index]; const TSCharacterRange *range = &ranges[mid_index];
if (lookahead >= range->start && lookahead <= range->end) { if (lookahead >= range->start && lookahead <= range->end) {
return true; return true;
} else if (lookahead > range->end) { } else if (lookahead > range->end) {
@@ -145,7 +165,7 @@ static inline bool set_contains(TSCharacterRange *ranges, uint32_t len, int32_t
} }
size -= half_size; size -= half_size;
} }
TSCharacterRange *range = &ranges[index]; const TSCharacterRange *range = &ranges[index];
return (lookahead >= range->start && lookahead <= range->end); return (lookahead >= range->start && lookahead <= range->end);
} }

View File

@@ -1,47 +0,0 @@
=======================
Assert res.status = 200
=======================
assert {
res.status: eq 200
}
---
(source_file
(varsandassert
(assert
(keyword)
(assert_dictionary
(assert_dictionary_pair
(assert_key)
(value)
)
)
)
)
)
=======================
Assert with empty value
=======================
assert {
res.status:
}
---
(source_file
(varsandassert
(assert
(keyword)
(assert_dictionary
(assert_dictionary_pair
(assert_key)
(value)
)
)
)
)
)

View File

@@ -1,57 +0,0 @@
===========
Auth Oauth2
===========
auth:oauth2 {
grant_type: authorization_code
scope: read write
}
---
(source_file
(auths
(authoauth2
(keyword)
(dictionary
(dictionary_pair
(key)
(value)
)
(dictionary_pair
(key)
(value)
)
)
)
)
)
===========================================
Auth Basic with empty username and password
===========================================
auth:basic {
username:
password:
}
---
(source_file
(auths
(authbasic
(keyword)
(dictionary
(dictionary_pair
(key)
(value)
)
(dictionary_pair
(key)
(value)
)
)
)
)
)

View File

@@ -1,192 +0,0 @@
==========
JSON Body
==========
body:json {
{
"apiKey": "secret",
"numbers": "9988776655",
"message": "Woof! lets play with some apis"
}
}
---
(source_file
(bodies
(bodyjson
(keyword)
(textblock
(rawtext)
)
)
)
)
==========
Text Body
==========
body:text {
This is a text body
}
---
(source_file
(bodies
(bodytext
(keyword)
(textblock
(rawtext)
)
)
)
)
=========
XML Body
=========
body:xml {
<xml>
<name>John</name>
<age>30</age>
</xml>
}
---
(source_file
(bodies
(bodyxml
(keyword)
(textblock
(rawtext)
)
)
)
)
=============
GraphQL Body
=============
body:graphql {
{
launchesPast {
launch_site {
site_name
}
launch_success
}
}
}
---
(source_file
(bodies
(bodygraphql
(keyword)
(textblock
(rawtext)
)
)
)
)
==================
GraphQL Vars Body
==================
body:graphql:vars {
{
"limit": 5
}
}
---
(source_file
(bodies
(bodygraphqlvars
(keyword)
(textblock
(rawtext)
)
)
)
)
=====================
Form URLEncoded Body
=====================
body:form-urlencoded {
apikey: secret
numbers: +91998877665
~message: hello
}
---
(source_file
(bodies
(bodyforms
(bodyformurlencoded
(keyword)
(dictionary
(dictionary_pair
(key)
(value)
)
(dictionary_pair
(key)
(value)
)
(dictionary_pair
(key)
(value)
)
)
)
)
)
)
=====================
Form Multipart Body
=====================
body:multipart-form {
apikey: secret
numbers: +91998877665
~message: hello
}
---
(source_file
(bodies
(bodyforms
(bodyformmultipart
(keyword)
(dictionary
(dictionary_pair
(key)
(value)
)
(dictionary_pair
(key)
(value)
)
(dictionary_pair
(key)
(value)
)
)
)
)
)
)

View File

@@ -1,31 +0,0 @@
================
META Tag
================
meta {
name: Get users
type: http
seq: 1
}
---
(source_file
tag: (meta
(keyword)
(dictionary
(dictionary_pair
(key)
(value)
)
(dictionary_pair
(key)
(value)
)
(dictionary_pair
(key)
(value)
)
)
)
)

View File

@@ -1,239 +0,0 @@
=====================
Query Parameters Tag
=====================
query {
apiKey: secret
numbers: 9988776655
message: hello
}
---
(source_file
tag: (query
(keyword)
(dictionary
(dictionary_pair
(key)
(value)
)
(dictionary_pair
(key)
(value)
)
(dictionary_pair
(key)
(value)
)
)
)
)
============
Headers Tag
============
headers {
content-type: application/json
Authorization: Bearer topsecret
}
---
(source_file
tag: (headers
(keyword)
(dictionary
(dictionary_pair
(key)
(value)
)
(dictionary_pair
(key)
(value)
)
)
)
)
===============
GET Method Tag
===============
get {
url: https://github.com/Scalamando/tree-sitter-bruno
body: JSON
}
---
(source_file
tag: (http
(keyword)
(dictionary
(dictionary_pair
(key)
(value)
)
(dictionary_pair
(key)
(value)
)
)
)
)
================
POST Method Tag
================
post {
url: https://api.github.com/users/usebruno
}
---
(source_file
tag: (http
(keyword)
(dictionary
(dictionary_pair
(key)
(value)
)
)
)
)
===============
PUT Method Tag
===============
put {
url: https://api.github.com/users/usebruno
}
---
(source_file
tag: (http
(keyword)
(dictionary
(dictionary_pair
(key)
(value)
)
)
)
)
==================
DELETE Method Tag
==================
delete {
url: https://api.github.com/users/usebruno
}
---
(source_file
tag: (http
(keyword)
(dictionary
(dictionary_pair
(key)
(value)
)
)
)
)
===================
OPTIONS Method Tag
===================
options {
url: https://api.github.com/users/usebruno
}
---
(source_file
tag: (http
(keyword)
(dictionary
(dictionary_pair
(key)
(value)
)
)
)
)
=================
TRACE Method Tag
=================
trace {
url: https://api.github.com/users/usebruno
}
---
(source_file
tag: (http
(keyword)
(dictionary
(dictionary_pair
(key)
(value)
)
)
)
)
===================
CONNECT Method Tag
===================
connect {
url: https://api.github.com/users/usebruno
}
---
(source_file
tag: (http
(keyword)
(dictionary
(dictionary_pair
(key)
(value)
)
)
)
)
================
HEAD Method Tag
================
head {
url: https://api.github.com/users/usebruno
}
---
(source_file
tag: (http
(keyword)
(dictionary
(dictionary_pair
(key)
(value)
)
)
)
)

View File

@@ -1,197 +0,0 @@
=================
GET with headers
=================
get {
url: https://api.textlocal.in/send?apiKey=secret&numbers=9988776655&message=hello
}
headers {
content-type: application/json
Authorization: Bearer topsecret
}
---
(source_file
tag: (http
(keyword)
(dictionary
(dictionary_pair
(key)
(value)
)
)
)
tag: (headers
(keyword)
(dictionary
(dictionary_pair
(key)
(value)
)
(dictionary_pair
(key)
(value)
)
)
)
)
===============
POST with body
===============
post {
url: https://api.textlocal.in/send
}
body {
{
"apiKey": "secret",
"numbers": "9988776655",
"message": "Woof! lets play with some apis"
}
}
headers {
content-type: application/json
Authorization: Bearer topsecret
}
---
(source_file
tag: (http
(keyword)
(dictionary
(dictionary_pair
(key)
(value)
)
)
)
tag: (bodies
(body
(keyword)
(textblock
(rawtext)
)
)
)
tag: (headers
(keyword)
(dictionary
(dictionary_pair
(key)
(value)
)
(dictionary_pair
(key)
(value)
)
)
)
)
==========
Scripting
==========
post {
url: https://api.textlocal.in/login
}
body {
{
"username": "johnnash",
"password": "governingdynamics"
}
}
script:post-response {
bru.setVar("token", res.body.token);
}
---
(source_file
tag: (http
(keyword)
(dictionary
(dictionary_pair
(key)
(value)
)
)
)
tag: (bodies
(body
(keyword)
(textblock
(rawtext)
)
)
)
tag: (script
(scriptres
(keyword)
(textblock
(rawtext)
)
)
)
)
========
Testing
========
post {
url: https://api.textlocal.in/login
}
body {
{
"username": "johnnash",
"password": "governingdynamics"
}
}
tests {
test("should be able to login", function() {
expect(res.status).to.equal(201);
});
test("should receive the token", function() {
expect(res.body.token).to.be.a('string');
});
}
---
(source_file
tag: (http
(keyword)
(dictionary
(dictionary_pair
(key)
(value)
)
)
)
tag: (bodies
(body
(keyword)
(textblock
(rawtext)
)
)
)
tag: (tests
(keyword)
(textblock
(rawtext)
)
)
)

View File

@@ -1,60 +0,0 @@
========================
Script Pre-Request Tags
========================
script:pre-request {
req.setHeader("Authorization", "{{token}}");
}
---
(source_file
tag: (script
(scriptreq
(keyword)
(textblock
(rawtext)
)
)
)
)
========================
Script Post-Response Tags
========================
script:post-response {
bru.setVar("token", res.body.token);
}
---
(source_file
tag: (script
(scriptres
(keyword)
(textblock
(rawtext)
)
)
)
)
========================
Test Tags
========================
tests {
expect(res.status).to.equal(200);
}
---
(source_file
tag: (tests
(keyword)
(textblock
(rawtext)
)
)
)

View File

@@ -1,35 +1,25 @@
{ {
"$schema": "https://tree-sitter.github.io/tree-sitter/assets/schemas/config.schema.json",
"grammars": [ "grammars": [
{ {
"name": "bruno", "name": "bruno",
"camelcase": "Bruno", "camelcase": "Bruno",
"title": "Bruno",
"scope": "source.bruno", "scope": "source.bruno",
"path": ".",
"file-types": [ "file-types": [
"bru" "bru"
], ],
"injection-regex": "^bruno$", "injection-regex": "^bruno$",
"highlights": [ "class-name": "TreeSitterBruno",
"queries/bruno/highlights.scm" "highlights": "queries/highlights.scm",
], "injections": "queries/injections.scm",
"injections": [ "tags": "queries/tags.scm"
"queries/bruno/injections.scm"
],
"tags": [
"queries/bruno/tags.scm"
],
"folds": [
"queries/bruno/folds.scm"
],
"indents": [
"queries/bruno/folds.scm"
]
} }
], ],
"metadata": { "metadata": {
"version": "0.1.0", "version": "0.1.0",
"license": "MIT", "license": "MIT",
"description": " Bruno grammar for tree-sitter", "description": "Bruno grammar for tree-sitter",
"authors": [ "authors": [
{ {
"name": "Kristofers Solo", "name": "Kristofers Solo",
@@ -37,7 +27,7 @@
} }
], ],
"links": { "links": {
"repository": "https://github.com/kristoferssolo/tree-sitter-bruno" "repository": "https://codeberg.org/kristoferssolo/tree-sitter-bruno"
} }
}, },
"bindings": { "bindings": {
@@ -46,6 +36,7 @@
"node": true, "node": true,
"python": true, "python": true,
"rust": true, "rust": true,
"swift": true "swift": true,
"zig": false
} }
} }

96
uv.lock generated
View File

@@ -1,96 +0,0 @@
version = 1
requires-python = ">=3.9"
[[package]]
name = "ruff"
version = "0.8.3"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/bf/5e/683c7ef7a696923223e7d95ca06755d6e2acbc5fd8382b2912a28008137c/ruff-0.8.3.tar.gz", hash = "sha256:5e7558304353b84279042fc584a4f4cb8a07ae79b2bf3da1a7551d960b5626d3", size = 3378522 }
wheels = [
{ url = "https://files.pythonhosted.org/packages/f8/c4/bfdbb8b9c419ff3b52479af8581026eeaac3764946fdb463dec043441b7d/ruff-0.8.3-py3-none-linux_armv6l.whl", hash = "sha256:8d5d273ffffff0acd3db5bf626d4b131aa5a5ada1276126231c4174543ce20d6", size = 10535860 },
{ url = "https://files.pythonhosted.org/packages/ef/c5/0aabdc9314b4b6f051168ac45227e2aa8e1c6d82718a547455e40c9c9faa/ruff-0.8.3-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:e4d66a21de39f15c9757d00c50c8cdd20ac84f55684ca56def7891a025d7e939", size = 10346327 },
{ url = "https://files.pythonhosted.org/packages/1a/78/4843a59e7e7b398d6019cf91ab06502fd95397b99b2b858798fbab9151f5/ruff-0.8.3-py3-none-macosx_11_0_arm64.whl", hash = "sha256:c356e770811858bd20832af696ff6c7e884701115094f427b64b25093d6d932d", size = 9942585 },
{ url = "https://files.pythonhosted.org/packages/91/5a/642ed8f1ba23ffc2dd347697e01eef3c42fad6ac76603be4a8c3a9d6311e/ruff-0.8.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9c0a60a825e3e177116c84009d5ebaa90cf40dfab56e1358d1df4e29a9a14b13", size = 10797597 },
{ url = "https://files.pythonhosted.org/packages/30/25/2e654bc7226da09a49730a1a2ea6e89f843b362db80b4b2a7a4f948ac986/ruff-0.8.3-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:75fb782f4db39501210ac093c79c3de581d306624575eddd7e4e13747e61ba18", size = 10307244 },
{ url = "https://files.pythonhosted.org/packages/c0/2d/a224d56bcd4383583db53c2b8f410ebf1200866984aa6eb9b5a70f04e71f/ruff-0.8.3-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7f26bc76a133ecb09a38b7868737eded6941b70a6d34ef53a4027e83913b6502", size = 11362439 },
{ url = "https://files.pythonhosted.org/packages/82/01/03e2857f9c371b8767d3e909f06a33bbdac880df17f17f93d6f6951c3381/ruff-0.8.3-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:01b14b2f72a37390c1b13477c1c02d53184f728be2f3ffc3ace5b44e9e87b90d", size = 12078538 },
{ url = "https://files.pythonhosted.org/packages/af/ae/ff7f97b355da16d748ceec50e1604a8215d3659b36b38025a922e0612e9b/ruff-0.8.3-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:53babd6e63e31f4e96ec95ea0d962298f9f0d9cc5990a1bbb023a6baf2503a82", size = 11616172 },
{ url = "https://files.pythonhosted.org/packages/6a/d0/6156d4d1e53ebd17747049afe801c5d7e3014d9b2f398b9236fe36ba4320/ruff-0.8.3-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:1ae441ce4cf925b7f363d33cd6570c51435972d697e3e58928973994e56e1452", size = 12919886 },
{ url = "https://files.pythonhosted.org/packages/4e/84/affcb30bacb94f6036a128ad5de0e29f543d3f67ee42b490b17d68e44b8a/ruff-0.8.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d7c65bc0cadce32255e93c57d57ecc2cca23149edd52714c0c5d6fa11ec328cd", size = 11212599 },
{ url = "https://files.pythonhosted.org/packages/60/b9/5694716bdefd8f73df7c0104334156c38fb0f77673d2966a5a1345bab94d/ruff-0.8.3-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:5be450bb18f23f0edc5a4e5585c17a56ba88920d598f04a06bd9fd76d324cb20", size = 10784637 },
{ url = "https://files.pythonhosted.org/packages/24/7e/0e8f835103ac7da81c3663eedf79dec8359e9ae9a3b0d704bae50be59176/ruff-0.8.3-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:8faeae3827eaa77f5721f09b9472a18c749139c891dbc17f45e72d8f2ca1f8fc", size = 10390591 },
{ url = "https://files.pythonhosted.org/packages/27/da/180ec771fc01c004045962ce017ca419a0281f4bfaf867ed0020f555b56e/ruff-0.8.3-py3-none-musllinux_1_2_i686.whl", hash = "sha256:db503486e1cf074b9808403991663e4277f5c664d3fe237ee0d994d1305bb060", size = 10894298 },
{ url = "https://files.pythonhosted.org/packages/6d/f8/29f241742ed3954eb2222314b02db29f531a15cab3238d1295e8657c5f18/ruff-0.8.3-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:6567be9fb62fbd7a099209257fef4ad2c3153b60579818b31a23c886ed4147ea", size = 11275965 },
{ url = "https://files.pythonhosted.org/packages/79/e9/5b81dc9afc8a80884405b230b9429efeef76d04caead904bd213f453b973/ruff-0.8.3-py3-none-win32.whl", hash = "sha256:19048f2f878f3ee4583fc6cb23fb636e48c2635e30fb2022b3a1cd293402f964", size = 8807651 },
{ url = "https://files.pythonhosted.org/packages/ea/67/7291461066007617b59a707887b90e319b6a043c79b4d19979f86b7a20e7/ruff-0.8.3-py3-none-win_amd64.whl", hash = "sha256:f7df94f57d7418fa7c3ffb650757e0c2b96cf2501a0b192c18e4fb5571dfada9", size = 9625289 },
{ url = "https://files.pythonhosted.org/packages/03/8f/e4fa95288b81233356d9a9dcaed057e5b0adc6399aa8fd0f6d784041c9c3/ruff-0.8.3-py3-none-win_arm64.whl", hash = "sha256:fe2756edf68ea79707c8d68b78ca9a58ed9af22e430430491ee03e718b5e4936", size = 9078754 },
]
[[package]]
name = "tree-sitter"
version = "0.23.2"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/0f/50/fd5fafa42b884f741b28d9e6fd366c3f34e15d2ed3aa9633b34e388379e2/tree-sitter-0.23.2.tar.gz", hash = "sha256:66bae8dd47f1fed7bdef816115146d3a41c39b5c482d7bad36d9ba1def088450", size = 166800 }
wheels = [
{ url = "https://files.pythonhosted.org/packages/91/04/2068a7b725265ecfcbf63ecdae038f1d4124ebccd55b8a7ce145b70e2b6a/tree_sitter-0.23.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:3a937f5d8727bc1c74c4bf2a9d1c25ace049e8628273016ad0d45914ae904e10", size = 139289 },
{ url = "https://files.pythonhosted.org/packages/a8/07/a5b943121f674fe1ac77694a698e71ce95353830c1f3f4ce45da7ef3e406/tree_sitter-0.23.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:2c7eae7fe2af215645a38660d2d57d257a4c461fe3ec827cca99a79478284e80", size = 132379 },
{ url = "https://files.pythonhosted.org/packages/d4/96/fcc72c33d464a2d722db1e95b74a53ced771a47b3cfde60aced29764a783/tree_sitter-0.23.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3a71d607595270b6870eaf778a1032d146b2aa79bfcfa60f57a82a7b7584a4c7", size = 552884 },
{ url = "https://files.pythonhosted.org/packages/d0/af/b0e787a52767155b4643a55d6de03c1e4ae77abb61e1dc1629ad983e0a40/tree_sitter-0.23.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6fe9b9ea7a0aa23b52fd97354da95d1b2580065bc12a4ac868f9164a127211d6", size = 566561 },
{ url = "https://files.pythonhosted.org/packages/65/fd/05e966b5317b1c6679c071c5b0203f28af9d26c9363700cb9682e1bcf343/tree_sitter-0.23.2-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:d74d00a8021719eae14d10d1b1e28649e15d8b958c01c2b2c3dad7a2ebc4dbae", size = 558273 },
{ url = "https://files.pythonhosted.org/packages/60/bc/19145efdf3f47711aa3f1bf06f0b50593f97f1108550d38694841fd97b7c/tree_sitter-0.23.2-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:6de18d8d8a7f67ab71f472d1fcb01cc506e080cbb5e13d52929e4b6fdce6bbee", size = 569176 },
{ url = "https://files.pythonhosted.org/packages/32/08/3553d8e488ae9284a0762effafb7d2639a306e184963b7f99853923084d6/tree_sitter-0.23.2-cp310-cp310-win_amd64.whl", hash = "sha256:12b60dca70d2282af942b650a6d781be487485454668c7c956338a367b98cdee", size = 117902 },
{ url = "https://files.pythonhosted.org/packages/1d/39/836fa485e985c33e8aa1cc3abbf7a84be1c2c382e69547a765631fdd7ce3/tree_sitter-0.23.2-cp310-cp310-win_arm64.whl", hash = "sha256:3346a4dd0447a42aabb863443b0fd8c92b909baf40ed2344fae4b94b625d5955", size = 102644 },
{ url = "https://files.pythonhosted.org/packages/55/8d/2d4fb04408772be0919441d66f700673ce7cb76b9ab6682e226d740fb88d/tree_sitter-0.23.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:91fda41d4f8824335cc43c64e2c37d8089c8c563bd3900a512d2852d075af719", size = 139142 },
{ url = "https://files.pythonhosted.org/packages/32/52/b8a44bfff7b0203256e5dbc8d3a372ee8896128b8ed7d3a89e1ef17b2065/tree_sitter-0.23.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:92b2b489d5ce54b41f94c6f23fbaf592bd6e84dc2877048fd1cb060480fa53f7", size = 132198 },
{ url = "https://files.pythonhosted.org/packages/5d/54/746f2ee5acf6191a4a0be7f5843329f0d713bfe5196f5fc6fe2ea69cb44c/tree_sitter-0.23.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:64859bd4aa1567d0d6016a811b2b49c59d4a4427d096e3d8c84b2521455f62b7", size = 554303 },
{ url = "https://files.pythonhosted.org/packages/2f/5a/3169d9933be813776a9b4b3f2e671d3d50fa27e589dee5578f6ecef7ff6d/tree_sitter-0.23.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:614590611636044e071d3a0b748046d52676dbda3bc9fa431216231e11dd98f7", size = 567626 },
{ url = "https://files.pythonhosted.org/packages/32/0d/23f363b3b0bc3fa0e7a4a294bf119957ac1ab02737d57815e1e8b7b3e196/tree_sitter-0.23.2-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:08466953c78ae57be61057188fb88c89791b0a562856010228e0ccf60e2ac453", size = 559803 },
{ url = "https://files.pythonhosted.org/packages/6f/b3/1ffba0f17a7ff2c9114d91a1ecc15e0748f217817797564d31fbb61d7458/tree_sitter-0.23.2-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:8a33f03a562de91f7fd05eefcedd8994a06cd44c62f7aabace811ad82bc11cbd", size = 570987 },
{ url = "https://files.pythonhosted.org/packages/59/4b/085bcb8a11ea18003aacc4dbc91c301d1536c5e2deedb95393e8ef26f1f7/tree_sitter-0.23.2-cp311-cp311-win_amd64.whl", hash = "sha256:03b70296b569ef64f7b92b42ca5da9bf86d81bee2afd480bea35092687f51dae", size = 117771 },
{ url = "https://files.pythonhosted.org/packages/4b/e5/90adc4081f49ccb6bea89a800dc9b0dcc5b6953b0da423e8eff28f63fddf/tree_sitter-0.23.2-cp311-cp311-win_arm64.whl", hash = "sha256:7cb4bb953ea7c0b50eeafc4454783e030357179d2a93c3dd5ebed2da5588ddd0", size = 102555 },
{ url = "https://files.pythonhosted.org/packages/07/a7/57e0fe87b49a78c670a7b4483f70e44c000c65c29b138001096b22e7dd87/tree_sitter-0.23.2-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:a014498b6a9e6003fae8c6eb72f5927d62da9dcb72b28b3ce8cd15c6ff6a6572", size = 139259 },
{ url = "https://files.pythonhosted.org/packages/b4/b9/bc8513d818ffb54993a017a36c8739300bc5739a13677acf90b54995e7db/tree_sitter-0.23.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:04f8699b131d4bcbe3805c37e4ef3d159ee9a82a0e700587625623999ba0ea53", size = 131951 },
{ url = "https://files.pythonhosted.org/packages/d7/6a/eab01bb6b1ce3c9acf16d72922ffc29a904af485eb3e60baf3a3e04edd30/tree_sitter-0.23.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4471577df285059c71686ecb208bc50fb472099b38dcc8e849b0e86652891e87", size = 557952 },
{ url = "https://files.pythonhosted.org/packages/bd/95/f2f73332623cf63200d57800f85273170bc5f99d28ea3f234afd5b0048df/tree_sitter-0.23.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f342c925290dd4e20ecd5787ef7ae8749981597ab364783a1eb73173efe65226", size = 571199 },
{ url = "https://files.pythonhosted.org/packages/04/ac/bd6e6cfdd0421156e86f5c93848629af1c7323083077e1a95b27d32d5811/tree_sitter-0.23.2-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:a4e9e53d07dd076bede72e4f7d3a0173d7b9ad6576572dd86da008a740a9bb22", size = 562129 },
{ url = "https://files.pythonhosted.org/packages/7b/bd/8a9edcbcf8a76b0bf58e3b927ed291e3598e063d56667367762833cc8709/tree_sitter-0.23.2-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:8caebe65bc358759dac2500d8f8feed3aed939c4ade9a684a1783fe07bc7d5db", size = 574307 },
{ url = "https://files.pythonhosted.org/packages/0c/c2/3fb2c6c0ae2f59a7411dc6d3e7945e3cb6f34c8552688708acc8b2b13f83/tree_sitter-0.23.2-cp312-cp312-win_amd64.whl", hash = "sha256:fc5a72eb50d43485000dbbb309acb350467b7467e66dc747c6bb82ce63041582", size = 117858 },
{ url = "https://files.pythonhosted.org/packages/e2/18/4ca2c0f4a0c802ebcb3a92264cc436f1d54b394fa24dfa76bf57cdeaca9e/tree_sitter-0.23.2-cp312-cp312-win_arm64.whl", hash = "sha256:a0320eb6c7993359c5f7b371d22719ccd273f440d41cf1bd65dac5e9587f2046", size = 102496 },
{ url = "https://files.pythonhosted.org/packages/ba/c6/4ead9ce3113a7c27f37a2bdef163c09757efbaa85adbdfe7b3fbf0317c57/tree_sitter-0.23.2-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:eff630dddee7ba05accb439b17e559e15ce13f057297007c246237ceb6306332", size = 139266 },
{ url = "https://files.pythonhosted.org/packages/76/c9/b4197c5b0c1d6ba648202a547846ac910a53163b69a459504b2aa6cdb76e/tree_sitter-0.23.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:4780ba8f3894f2dea869fad2995c2aceab3fd5ab9e6a27c45475d2acd7f7e84e", size = 131959 },
{ url = "https://files.pythonhosted.org/packages/99/94/0f7c5580d2adff3b57d36f1998725b0caf6cf1af50ceafc00c6cdbc2fef6/tree_sitter-0.23.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f0b609460b8e3e256361fb12e94fae5b728cb835b16f0f9d590b5aadbf9d109b", size = 557582 },
{ url = "https://files.pythonhosted.org/packages/97/8a/f73ff06959d43fd47fc283cbcc4d8efa6550b2cc431d852b184504992447/tree_sitter-0.23.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:78d070d8eaeaeb36cf535f55e5578fddbfc3bf53c1980f58bf1a99d57466b3b5", size = 570891 },
{ url = "https://files.pythonhosted.org/packages/b8/86/bbda5ad09b88051ff7bf3275622a2f79bc4f728b4c283ff8b93b8fcdf36d/tree_sitter-0.23.2-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:878580b2ad5054c410ba3418edca4d34c81cc26706114d8f5b5541688bc2d785", size = 562343 },
{ url = "https://files.pythonhosted.org/packages/ca/55/b404fa49cb5c2926ad6fe1cac033dd486ef69f1afeb7828452d21e1e05c1/tree_sitter-0.23.2-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:29224bdc2a3b9af535b7725e249d3ee291b2e90708e82832e73acc175e40dc48", size = 574407 },
{ url = "https://files.pythonhosted.org/packages/c2/c8/eea2104443ab973091107ef3e730683bd8e6cb51dd025cef853d3fff9dae/tree_sitter-0.23.2-cp313-cp313-win_amd64.whl", hash = "sha256:c58d89348162fbc3aea1fe6511a66ee189fc0e4e4bbe937026f29e4ecef17763", size = 117854 },
{ url = "https://files.pythonhosted.org/packages/89/4d/1728d9ce32a1d851081911b7e47830f5e740431f2bb920f54bb8c26175bc/tree_sitter-0.23.2-cp313-cp313-win_arm64.whl", hash = "sha256:0ff2037be5edab7801de3f6a721b9cf010853f612e2008ee454e0e0badb225a6", size = 102492 },
{ url = "https://files.pythonhosted.org/packages/cb/ab/b39173a47d498cc6276e303c865f4a222134ceae890bd3c1b29427489805/tree_sitter-0.23.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:a5db8e585205faef8bf219da77d8993e2ef04d08eda2e3c8ad7e4df8297ee344", size = 139550 },
{ url = "https://files.pythonhosted.org/packages/4c/34/fa8f5b862dd7a6014fd5578810178e8f7601830cabb6d65d2aba050c2df1/tree_sitter-0.23.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:9dbd110a30cf28be5da734ae4cd0e9031768228dbf6a79f2973962aa51de4ec7", size = 132686 },
{ url = "https://files.pythonhosted.org/packages/98/b9/ccdddf35705fc23395caa71557f767e0753d38afe4b5bb99efddbf62bb22/tree_sitter-0.23.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:569514b9a996a0fd458b3a891c46ca125298be0c03cf82f2b6f0c13d5d8f25dc", size = 554958 },
{ url = "https://files.pythonhosted.org/packages/8d/ba/20ae9079bdfc5cfac28b39d945a6c354c8e1385e73aec8142db6c53b635c/tree_sitter-0.23.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a357ed98a74e47787b812df99a74a2c35c0fe11e55c2095cc01d1cad144ef552", size = 568162 },
{ url = "https://files.pythonhosted.org/packages/40/00/b16bf6cf88c47c1b6c8e1cce1eb9e90badb5db9e5252ae0970d858d02592/tree_sitter-0.23.2-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:c2dfb8e8f760f4cc67888d03ef9e2dbd3353245f67f5efba375c2a14d944ac0e", size = 560278 },
{ url = "https://files.pythonhosted.org/packages/7a/8f/27ab9b96cc0261af78b080ec8a9846a38e216360ec38774ea27eba35bd3c/tree_sitter-0.23.2-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:3ead958df87a21d706903987e665e9e0e5df7b2c5021ff69ea349826840adc6a", size = 571255 },
{ url = "https://files.pythonhosted.org/packages/44/e0/95a3d66a7e5bb229574484ab10c6dc99d1c7a32972b890d194076e30dc4f/tree_sitter-0.23.2-cp39-cp39-win_amd64.whl", hash = "sha256:611cae16be332213c0e6ece72c0bfca202e30ff320a8b309b1526c6cb79ee4ba", size = 118232 },
{ url = "https://files.pythonhosted.org/packages/10/b5/9eaf794fc71490573ab14a366affca415bc1ddbf86a14d78e54583db4254/tree_sitter-0.23.2-cp39-cp39-win_arm64.whl", hash = "sha256:b848e0fdd522fbb8888cdb4f4d93f8fad97ae10d70c122fb922e51363c7febcd", size = 102787 },
]
[[package]]
name = "tree-sitter-bruno"
version = "0.1.0"
source = { editable = "." }
[package.optional-dependencies]
core = [
{ name = "tree-sitter" },
]
[package.dev-dependencies]
dev = [
{ name = "ruff" },
]
[package.metadata]
requires-dist = [{ name = "tree-sitter", marker = "extra == 'core'", specifier = "~=0.22" }]
[package.metadata.requires-dev]
dev = [{ name = "ruff", specifier = ">=0.8.3" }]