mirror of
https://github.com/kristoferssolo/tree-sitter-bruno.git
synced 2025-10-21 20:10:34 +00:00
Initial commit
This commit is contained in:
commit
9a923cded1
43
.editorconfig
Normal file
43
.editorconfig
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
|
||||||
|
[*.{json,toml,yml,gyp}]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[*.js]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[*.scm]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[*.{c,cc,h}]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
|
[*.rs]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
|
[*.{py,pyi}]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
|
[*.swift]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
|
[*.go]
|
||||||
|
indent_style = tab
|
||||||
|
indent_size = 8
|
||||||
|
|
||||||
|
[Makefile]
|
||||||
|
indent_style = tab
|
||||||
|
indent_size = 8
|
||||||
|
|
||||||
|
[parser.c]
|
||||||
|
indent_size = 2
|
||||||
13
.gitattributes
vendored
Normal file
13
.gitattributes
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
* text=auto eol=lf
|
||||||
|
|
||||||
|
src/*.json linguist-generated
|
||||||
|
src/parser.c linguist-generated
|
||||||
|
src/tree_sitter/* linguist-generated
|
||||||
|
|
||||||
|
bindings/** linguist-generated
|
||||||
|
binding.gyp linguist-generated
|
||||||
|
setup.py linguist-generated
|
||||||
|
Makefile linguist-generated
|
||||||
|
CMakeLists.txt linguist-generated
|
||||||
|
Package.swift linguist-generated
|
||||||
|
go.mod linguist-generated
|
||||||
40
.gitignore
vendored
Normal file
40
.gitignore
vendored
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
# Rust artifacts
|
||||||
|
target/
|
||||||
|
|
||||||
|
# Node artifacts
|
||||||
|
build/
|
||||||
|
prebuilds/
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# Swift artifacts
|
||||||
|
.build/
|
||||||
|
|
||||||
|
# Go artifacts
|
||||||
|
_obj/
|
||||||
|
|
||||||
|
# Python artifacts
|
||||||
|
.venv/
|
||||||
|
dist/
|
||||||
|
*.egg-info
|
||||||
|
*.whl
|
||||||
|
|
||||||
|
# C artifacts
|
||||||
|
*.a
|
||||||
|
*.so
|
||||||
|
*.so.*
|
||||||
|
*.dylib
|
||||||
|
*.dll
|
||||||
|
*.pc
|
||||||
|
|
||||||
|
# Example dirs
|
||||||
|
/examples/*/
|
||||||
|
|
||||||
|
# Grammar volatiles
|
||||||
|
*.wasm
|
||||||
|
*.obj
|
||||||
|
*.o
|
||||||
|
|
||||||
|
# Archives
|
||||||
|
*.tar.gz
|
||||||
|
*.tgz
|
||||||
|
*.zip
|
||||||
60
CMakeLists.txt
generated
Normal file
60
CMakeLists.txt
generated
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.13)
|
||||||
|
|
||||||
|
project(tree-sitter-bruno
|
||||||
|
VERSION "0.1.0"
|
||||||
|
DESCRIPTION " Bruno grammar for tree-sitter"
|
||||||
|
HOMEPAGE_URL "https://github.com/kristoferssolo/tree-sitter-bruno"
|
||||||
|
LANGUAGES C)
|
||||||
|
|
||||||
|
option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
|
||||||
|
option(TREE_SITTER_REUSE_ALLOCATOR "Reuse the library allocator" OFF)
|
||||||
|
|
||||||
|
set(TREE_SITTER_ABI_VERSION 14 CACHE STRING "Tree-sitter ABI version")
|
||||||
|
if(NOT ${TREE_SITTER_ABI_VERSION} MATCHES "^[0-9]+$")
|
||||||
|
unset(TREE_SITTER_ABI_VERSION CACHE)
|
||||||
|
message(FATAL_ERROR "TREE_SITTER_ABI_VERSION must be an integer")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_program(TREE_SITTER_CLI tree-sitter DOC "Tree-sitter CLI")
|
||||||
|
|
||||||
|
add_custom_command(OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/src/parser.c"
|
||||||
|
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/grammar.json"
|
||||||
|
COMMAND "${TREE_SITTER_CLI}" generate src/grammar.json
|
||||||
|
--abi=${TREE_SITTER_ABI_VERSION}
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
|
COMMENT "Generating parser.c")
|
||||||
|
|
||||||
|
add_library(tree-sitter-bruno src/parser.c)
|
||||||
|
if(EXISTS src/scanner.c)
|
||||||
|
target_sources(tree-sitter-bruno PRIVATE src/scanner.c)
|
||||||
|
endif()
|
||||||
|
target_include_directories(tree-sitter-bruno PRIVATE src)
|
||||||
|
|
||||||
|
target_compile_definitions(tree-sitter-bruno PRIVATE
|
||||||
|
$<$<BOOL:${TREE_SITTER_REUSE_ALLOCATOR}>:TREE_SITTER_REUSE_ALLOCATOR>
|
||||||
|
$<$<CONFIG:Debug>:TREE_SITTER_DEBUG>)
|
||||||
|
|
||||||
|
set_target_properties(tree-sitter-bruno
|
||||||
|
PROPERTIES
|
||||||
|
C_STANDARD 11
|
||||||
|
POSITION_INDEPENDENT_CODE ON
|
||||||
|
SOVERSION "${TREE_SITTER_ABI_VERSION}.${PROJECT_VERSION_MAJOR}"
|
||||||
|
DEFINE_SYMBOL "")
|
||||||
|
|
||||||
|
configure_file(bindings/c/tree-sitter-bruno.pc.in
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/tree-sitter-bruno.pc" @ONLY)
|
||||||
|
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
|
install(FILES bindings/c/tree-sitter-bruno.h
|
||||||
|
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/tree_sitter")
|
||||||
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/tree-sitter-bruno.pc"
|
||||||
|
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig")
|
||||||
|
install(TARGETS tree-sitter-bruno
|
||||||
|
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
||||||
|
|
||||||
|
add_custom_target(test "${TREE_SITTER_CLI}" test
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
|
COMMENT "tree-sitter test")
|
||||||
|
|
||||||
|
# vim:ft=cmake:
|
||||||
96
Cargo.lock
generated
Normal file
96
Cargo.lock
generated
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
# 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"
|
||||||
27
Cargo.toml
Normal file
27
Cargo.toml
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
[package]
|
||||||
|
name = "tree-sitter-bruno"
|
||||||
|
description = " Bruno grammar for tree-sitter"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Kristofers Solo <dev@kristofers.xyz>"]
|
||||||
|
license = "MIT"
|
||||||
|
readme = "README.md"
|
||||||
|
keywords = ["incremental", "parsing", "tree-sitter", "bruno"]
|
||||||
|
categories = ["parsing", "text-editors"]
|
||||||
|
repository = "https://github.com/kristoferssolo/tree-sitter-bruno"
|
||||||
|
edition = "2021"
|
||||||
|
autoexamples = false
|
||||||
|
|
||||||
|
build = "bindings/rust/build.rs"
|
||||||
|
include = ["bindings/rust/*", "grammar.js", "queries/*", "src/*"]
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
path = "bindings/rust/lib.rs"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
tree-sitter-language = "0.1"
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
cc = "1.1.22"
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
tree-sitter = "0.24.3"
|
||||||
94
Makefile
generated
Normal file
94
Makefile
generated
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
ifeq ($(OS),Windows_NT)
|
||||||
|
$(error Windows is not supported)
|
||||||
|
endif
|
||||||
|
|
||||||
|
LANGUAGE_NAME := tree-sitter-bruno
|
||||||
|
HOMEPAGE_URL := https://github.com/kristoferssolo/tree-sitter-bruno
|
||||||
|
VERSION := 0.1.0
|
||||||
|
|
||||||
|
# repository
|
||||||
|
SRC_DIR := src
|
||||||
|
|
||||||
|
TS ?= tree-sitter
|
||||||
|
|
||||||
|
# install directory layout
|
||||||
|
PREFIX ?= /usr/local
|
||||||
|
INCLUDEDIR ?= $(PREFIX)/include
|
||||||
|
LIBDIR ?= $(PREFIX)/lib
|
||||||
|
PCLIBDIR ?= $(LIBDIR)/pkgconfig
|
||||||
|
|
||||||
|
# source/object files
|
||||||
|
PARSER := $(SRC_DIR)/parser.c
|
||||||
|
EXTRAS := $(filter-out $(PARSER),$(wildcard $(SRC_DIR)/*.c))
|
||||||
|
OBJS := $(patsubst %.c,%.o,$(PARSER) $(EXTRAS))
|
||||||
|
|
||||||
|
# flags
|
||||||
|
ARFLAGS ?= rcs
|
||||||
|
override CFLAGS += -I$(SRC_DIR) -std=c11 -fPIC
|
||||||
|
|
||||||
|
# ABI versioning
|
||||||
|
SONAME_MAJOR = $(shell sed -n 's/\#define LANGUAGE_VERSION //p' $(PARSER))
|
||||||
|
SONAME_MINOR = $(word 1,$(subst ., ,$(VERSION)))
|
||||||
|
|
||||||
|
# OS-specific bits
|
||||||
|
ifeq ($(shell uname),Darwin)
|
||||||
|
SOEXT = dylib
|
||||||
|
SOEXTVER_MAJOR = $(SONAME_MAJOR).$(SOEXT)
|
||||||
|
SOEXTVER = $(SONAME_MAJOR).$(SONAME_MINOR).$(SOEXT)
|
||||||
|
LINKSHARED = -dynamiclib -Wl,-install_name,$(LIBDIR)/lib$(LANGUAGE_NAME).$(SOEXTVER),-rpath,@executable_path/../Frameworks
|
||||||
|
else
|
||||||
|
SOEXT = so
|
||||||
|
SOEXTVER_MAJOR = $(SOEXT).$(SONAME_MAJOR)
|
||||||
|
SOEXTVER = $(SOEXT).$(SONAME_MAJOR).$(SONAME_MINOR)
|
||||||
|
LINKSHARED = -shared -Wl,-soname,lib$(LANGUAGE_NAME).$(SOEXTVER)
|
||||||
|
endif
|
||||||
|
ifneq ($(filter $(shell uname),FreeBSD NetBSD DragonFly),)
|
||||||
|
PCLIBDIR := $(PREFIX)/libdata/pkgconfig
|
||||||
|
endif
|
||||||
|
|
||||||
|
all: lib$(LANGUAGE_NAME).a lib$(LANGUAGE_NAME).$(SOEXT) $(LANGUAGE_NAME).pc
|
||||||
|
|
||||||
|
lib$(LANGUAGE_NAME).a: $(OBJS)
|
||||||
|
$(AR) $(ARFLAGS) $@ $^
|
||||||
|
|
||||||
|
lib$(LANGUAGE_NAME).$(SOEXT): $(OBJS)
|
||||||
|
$(CC) $(LDFLAGS) $(LINKSHARED) $^ $(LDLIBS) -o $@
|
||||||
|
ifneq ($(STRIP),)
|
||||||
|
$(STRIP) $@
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(LANGUAGE_NAME).pc: bindings/c/$(LANGUAGE_NAME).pc.in
|
||||||
|
sed -e 's|@PROJECT_VERSION@|$(VERSION)|' \
|
||||||
|
-e 's|@CMAKE_INSTALL_LIBDIR@|$(LIBDIR:$(PREFIX)/%=%)|' \
|
||||||
|
-e 's|@CMAKE_INSTALL_INCLUDEDIR@|$(INCLUDEDIR:$(PREFIX)/%=%)|' \
|
||||||
|
-e 's|@PROJECT_DESCRIPTION@|$(DESCRIPTION)|' \
|
||||||
|
-e 's|@PROJECT_HOMEPAGE_URL@|$(HOMEPAGE_URL)|' \
|
||||||
|
-e 's|@CMAKE_INSTALL_PREFIX@|$(PREFIX)|' $< > $@
|
||||||
|
|
||||||
|
$(PARSER): $(SRC_DIR)/grammar.json
|
||||||
|
$(TS) generate $^
|
||||||
|
|
||||||
|
install: all
|
||||||
|
install -d '$(DESTDIR)$(INCLUDEDIR)'/tree_sitter '$(DESTDIR)$(PCLIBDIR)' '$(DESTDIR)$(LIBDIR)'
|
||||||
|
install -m644 bindings/c/$(LANGUAGE_NAME).h '$(DESTDIR)$(INCLUDEDIR)'/tree_sitter/$(LANGUAGE_NAME).h
|
||||||
|
install -m644 $(LANGUAGE_NAME).pc '$(DESTDIR)$(PCLIBDIR)'/$(LANGUAGE_NAME).pc
|
||||||
|
install -m644 lib$(LANGUAGE_NAME).a '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).a
|
||||||
|
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_MAJOR) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXT)
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
$(RM) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).a \
|
||||||
|
'$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXTVER) \
|
||||||
|
'$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXTVER_MAJOR) \
|
||||||
|
'$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXT) \
|
||||||
|
'$(DESTDIR)$(INCLUDEDIR)'/tree_sitter/$(LANGUAGE_NAME).h \
|
||||||
|
'$(DESTDIR)$(PCLIBDIR)'/$(LANGUAGE_NAME).pc
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(RM) $(OBJS) $(LANGUAGE_NAME).pc lib$(LANGUAGE_NAME).a lib$(LANGUAGE_NAME).$(SOEXT)
|
||||||
|
|
||||||
|
test:
|
||||||
|
$(TS) test
|
||||||
|
|
||||||
|
.PHONY: all install uninstall clean test
|
||||||
37
Package.swift
generated
Normal file
37
Package.swift
generated
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// swift-tools-version:5.3
|
||||||
|
import PackageDescription
|
||||||
|
|
||||||
|
let package = Package(
|
||||||
|
name: "TreeSitterBruno",
|
||||||
|
products: [
|
||||||
|
.library(name: "TreeSitterBruno", targets: ["TreeSitterBruno"]),
|
||||||
|
],
|
||||||
|
dependencies: [
|
||||||
|
.package(url: "https://github.com/ChimeHQ/SwiftTreeSitter", from: "0.8.0"),
|
||||||
|
],
|
||||||
|
targets: [
|
||||||
|
.target(
|
||||||
|
name: "TreeSitterBruno",
|
||||||
|
dependencies: [],
|
||||||
|
path: ".",
|
||||||
|
sources: [
|
||||||
|
"src/parser.c",
|
||||||
|
"src/scanner.c",
|
||||||
|
],
|
||||||
|
resources: [
|
||||||
|
.copy("queries")
|
||||||
|
],
|
||||||
|
publicHeadersPath: "bindings/swift",
|
||||||
|
cSettings: [.headerSearchPath("src")]
|
||||||
|
),
|
||||||
|
.testTarget(
|
||||||
|
name: "TreeSitterBrunoTests",
|
||||||
|
dependencies: [
|
||||||
|
"SwiftTreeSitter",
|
||||||
|
"TreeSitterBruno",
|
||||||
|
],
|
||||||
|
path: "bindings/swift/TreeSitterBrunoTests"
|
||||||
|
)
|
||||||
|
],
|
||||||
|
cLanguageStandard: .c11
|
||||||
|
)
|
||||||
30
binding.gyp
generated
Normal file
30
binding.gyp
generated
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"target_name": "tree_sitter_bruno_binding",
|
||||||
|
"dependencies": [
|
||||||
|
"<!(node -p \"require('node-addon-api').targets\"):node_addon_api_except",
|
||||||
|
],
|
||||||
|
"include_dirs": [
|
||||||
|
"src",
|
||||||
|
],
|
||||||
|
"sources": [
|
||||||
|
"bindings/node/binding.cc",
|
||||||
|
"src/parser.c",
|
||||||
|
"src/scanner.c",
|
||||||
|
],
|
||||||
|
"conditions": [
|
||||||
|
["OS!='win'", {
|
||||||
|
"cflags_c": [
|
||||||
|
"-std=c11",
|
||||||
|
],
|
||||||
|
}, { # OS == "win"
|
||||||
|
"cflags_c": [
|
||||||
|
"/std:c11",
|
||||||
|
"/utf-8",
|
||||||
|
],
|
||||||
|
}],
|
||||||
|
],
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
16
bindings/c/tree-sitter-bruno.h
generated
Normal file
16
bindings/c/tree-sitter-bruno.h
generated
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#ifndef TREE_SITTER_BRUNO_H_
|
||||||
|
#define TREE_SITTER_BRUNO_H_
|
||||||
|
|
||||||
|
typedef struct TSLanguage TSLanguage;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
const TSLanguage *tree_sitter_bruno(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // TREE_SITTER_BRUNO_H_
|
||||||
11
bindings/c/tree-sitter-bruno.pc.in
generated
Normal file
11
bindings/c/tree-sitter-bruno.pc.in
generated
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
prefix=@CMAKE_INSTALL_PREFIX@
|
||||||
|
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
|
||||||
|
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
|
||||||
|
|
||||||
|
Name: tree-sitter-bruno
|
||||||
|
Description: @PROJECT_DESCRIPTION@
|
||||||
|
URL: @PROJECT_HOMEPAGE_URL@
|
||||||
|
Version: @PROJECT_VERSION@
|
||||||
|
Requires: @TS_REQUIRES@
|
||||||
|
Libs: -L${libdir} -ltree-sitter-bruno
|
||||||
|
Cflags: -I${includedir}
|
||||||
13
bindings/go/binding.go
generated
Normal file
13
bindings/go/binding.go
generated
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package tree_sitter_bruno
|
||||||
|
|
||||||
|
// #cgo CFLAGS: -std=c11 -fPIC
|
||||||
|
// #include "../../src/parser.c"
|
||||||
|
// #include "../../src/scanner.c"
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
import "unsafe"
|
||||||
|
|
||||||
|
// Get the tree-sitter Language for this grammar.
|
||||||
|
func Language() unsafe.Pointer {
|
||||||
|
return unsafe.Pointer(C.tree_sitter_bruno())
|
||||||
|
}
|
||||||
15
bindings/go/binding_test.go
generated
Normal file
15
bindings/go/binding_test.go
generated
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package tree_sitter_bruno_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
tree_sitter "github.com/tree-sitter/go-tree-sitter"
|
||||||
|
tree_sitter_bruno "github.com/kristoferssolo/tree-sitter-bruno/bindings/go"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestCanLoadGrammar(t *testing.T) {
|
||||||
|
language := tree_sitter.NewLanguage(tree_sitter_bruno.Language())
|
||||||
|
if language == nil {
|
||||||
|
t.Errorf("Error loading Bruno grammar")
|
||||||
|
}
|
||||||
|
}
|
||||||
20
bindings/node/binding.cc
generated
Normal file
20
bindings/node/binding.cc
generated
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#include <napi.h>
|
||||||
|
|
||||||
|
typedef struct TSLanguage TSLanguage;
|
||||||
|
|
||||||
|
extern "C" TSLanguage *tree_sitter_bruno();
|
||||||
|
|
||||||
|
// "tree-sitter", "language" hashed with BLAKE2
|
||||||
|
const napi_type_tag LANGUAGE_TYPE_TAG = {
|
||||||
|
0x8AF2E5212AD58ABF, 0xD5006CAD83ABBA16
|
||||||
|
};
|
||||||
|
|
||||||
|
Napi::Object Init(Napi::Env env, Napi::Object exports) {
|
||||||
|
exports["name"] = Napi::String::New(env, "bruno");
|
||||||
|
auto language = Napi::External<TSLanguage>::New(env, tree_sitter_bruno());
|
||||||
|
language.TypeTag(&LANGUAGE_TYPE_TAG);
|
||||||
|
exports["language"] = language;
|
||||||
|
return exports;
|
||||||
|
}
|
||||||
|
|
||||||
|
NODE_API_MODULE(tree_sitter_bruno_binding, Init)
|
||||||
9
bindings/node/binding_test.js
generated
Normal file
9
bindings/node/binding_test.js
generated
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
/// <reference types="node" />
|
||||||
|
|
||||||
|
const assert = require("node:assert");
|
||||||
|
const { test } = require("node:test");
|
||||||
|
|
||||||
|
test("can load grammar", () => {
|
||||||
|
const parser = new (require("tree-sitter"))();
|
||||||
|
assert.doesNotThrow(() => parser.setLanguage(require(".")));
|
||||||
|
});
|
||||||
28
bindings/node/index.d.ts
generated
vendored
Normal file
28
bindings/node/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
type BaseNode = {
|
||||||
|
type: string;
|
||||||
|
named: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
type ChildNode = {
|
||||||
|
multiple: boolean;
|
||||||
|
required: boolean;
|
||||||
|
types: BaseNode[];
|
||||||
|
};
|
||||||
|
|
||||||
|
type NodeInfo =
|
||||||
|
| (BaseNode & {
|
||||||
|
subtypes: BaseNode[];
|
||||||
|
})
|
||||||
|
| (BaseNode & {
|
||||||
|
fields: { [name: string]: ChildNode };
|
||||||
|
children: ChildNode[];
|
||||||
|
});
|
||||||
|
|
||||||
|
type Language = {
|
||||||
|
name: string;
|
||||||
|
language: unknown;
|
||||||
|
nodeTypeInfo: NodeInfo[];
|
||||||
|
};
|
||||||
|
|
||||||
|
declare const language: Language;
|
||||||
|
export = language;
|
||||||
7
bindings/node/index.js
generated
Normal file
7
bindings/node/index.js
generated
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
const root = require("path").join(__dirname, "..", "..");
|
||||||
|
|
||||||
|
module.exports = require("node-gyp-build")(root);
|
||||||
|
|
||||||
|
try {
|
||||||
|
module.exports.nodeTypeInfo = require("../../src/node-types.json");
|
||||||
|
} catch (_) {}
|
||||||
11
bindings/python/tests/test_binding.py
generated
Normal file
11
bindings/python/tests/test_binding.py
generated
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
from unittest import TestCase
|
||||||
|
|
||||||
|
import tree_sitter, tree_sitter_bruno
|
||||||
|
|
||||||
|
|
||||||
|
class TestLanguage(TestCase):
|
||||||
|
def test_can_load_grammar(self):
|
||||||
|
try:
|
||||||
|
tree_sitter.Language(tree_sitter_bruno.language())
|
||||||
|
except Exception:
|
||||||
|
self.fail("Error loading Bruno grammar")
|
||||||
42
bindings/python/tree_sitter_bruno/__init__.py
generated
Normal file
42
bindings/python/tree_sitter_bruno/__init__.py
generated
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
""" Bruno grammar for tree-sitter"""
|
||||||
|
|
||||||
|
from importlib.resources import files as _files
|
||||||
|
|
||||||
|
from ._binding import language
|
||||||
|
|
||||||
|
|
||||||
|
def _get_query(name, file):
|
||||||
|
query = _files(f"{__package__}.queries") / file
|
||||||
|
globals()[name] = query.read_text()
|
||||||
|
return globals()[name]
|
||||||
|
|
||||||
|
|
||||||
|
def __getattr__(name):
|
||||||
|
# NOTE: uncomment these to include any queries that this grammar contains:
|
||||||
|
|
||||||
|
if name == "HIGHLIGHTS_QUERY":
|
||||||
|
return _get_query("HIGHLIGHTS_QUERY", "highlights.scm")
|
||||||
|
if name == "INJECTIONS_QUERY":
|
||||||
|
return _get_query("INJECTIONS_QUERY", "injections.scm")
|
||||||
|
# if name == "LOCALS_QUERY":
|
||||||
|
# return _get_query("LOCALS_QUERY", "locals.scm")
|
||||||
|
# if name == "TAGS_QUERY":
|
||||||
|
# return _get_query("TAGS_QUERY", "tags.scm")
|
||||||
|
|
||||||
|
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"language",
|
||||||
|
# "HIGHLIGHTS_QUERY",
|
||||||
|
# "INJECTIONS_QUERY",
|
||||||
|
# "LOCALS_QUERY",
|
||||||
|
# "TAGS_QUERY",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def __dir__():
|
||||||
|
return sorted(__all__ + [
|
||||||
|
"__all__", "__builtins__", "__cached__", "__doc__", "__file__",
|
||||||
|
"__loader__", "__name__", "__package__", "__path__", "__spec__",
|
||||||
|
])
|
||||||
10
bindings/python/tree_sitter_bruno/__init__.pyi
generated
Normal file
10
bindings/python/tree_sitter_bruno/__init__.pyi
generated
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
from typing import Final
|
||||||
|
|
||||||
|
# NOTE: uncomment these to include any queries that this grammar contains:
|
||||||
|
|
||||||
|
HIGHLIGHTS_QUERY: Final[str]
|
||||||
|
INJECTIONS_QUERY: Final[str]
|
||||||
|
# LOCALS_QUERY: Final[str]
|
||||||
|
# TAGS_QUERY: Final[str]
|
||||||
|
|
||||||
|
def language() -> object: ...
|
||||||
27
bindings/python/tree_sitter_bruno/binding.c
generated
Normal file
27
bindings/python/tree_sitter_bruno/binding.c
generated
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#include <Python.h>
|
||||||
|
|
||||||
|
typedef struct TSLanguage TSLanguage;
|
||||||
|
|
||||||
|
TSLanguage *tree_sitter_bruno(void);
|
||||||
|
|
||||||
|
static PyObject* _binding_language(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(args)) {
|
||||||
|
return PyCapsule_New(tree_sitter_bruno(), "tree_sitter.Language", NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyMethodDef methods[] = {
|
||||||
|
{"language", _binding_language, METH_NOARGS,
|
||||||
|
"Get the tree-sitter language for this grammar."},
|
||||||
|
{NULL, NULL, 0, NULL}
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct PyModuleDef module = {
|
||||||
|
.m_base = PyModuleDef_HEAD_INIT,
|
||||||
|
.m_name = "_binding",
|
||||||
|
.m_doc = NULL,
|
||||||
|
.m_size = -1,
|
||||||
|
.m_methods = methods
|
||||||
|
};
|
||||||
|
|
||||||
|
PyMODINIT_FUNC PyInit__binding(void) {
|
||||||
|
return PyModule_Create(&module);
|
||||||
|
}
|
||||||
0
bindings/python/tree_sitter_bruno/py.typed
generated
Normal file
0
bindings/python/tree_sitter_bruno/py.typed
generated
Normal file
19
bindings/rust/build.rs
generated
Normal file
19
bindings/rust/build.rs
generated
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
fn main() {
|
||||||
|
let src_dir = std::path::Path::new("src");
|
||||||
|
|
||||||
|
let mut c_config = cc::Build::new();
|
||||||
|
c_config.std("c11").include(src_dir);
|
||||||
|
|
||||||
|
#[cfg(target_env = "msvc")]
|
||||||
|
c_config.flag("-utf-8");
|
||||||
|
|
||||||
|
let parser_path = src_dir.join("parser.c");
|
||||||
|
c_config.file(&parser_path);
|
||||||
|
println!("cargo:rerun-if-changed={}", parser_path.to_str().unwrap());
|
||||||
|
|
||||||
|
let scanner_path = src_dir.join("scanner.c");
|
||||||
|
c_config.file(&scanner_path);
|
||||||
|
println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap());
|
||||||
|
|
||||||
|
c_config.compile("tree-sitter-bruno");
|
||||||
|
}
|
||||||
53
bindings/rust/lib.rs
generated
Normal file
53
bindings/rust/lib.rs
generated
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
//! This crate provides Bruno language support for the [tree-sitter][] parsing library.
|
||||||
|
//!
|
||||||
|
//! Typically, you will use the [LANGUAGE][] constant to add this language to a
|
||||||
|
//! tree-sitter [Parser][], and then use the parser to parse some code:
|
||||||
|
//!
|
||||||
|
//! ```
|
||||||
|
//! let code = r#"
|
||||||
|
//! "#;
|
||||||
|
//! let mut parser = tree_sitter::Parser::new();
|
||||||
|
//! let language = tree_sitter_bruno::LANGUAGE;
|
||||||
|
//! parser
|
||||||
|
//! .set_language(&language.into())
|
||||||
|
//! .expect("Error loading Bruno parser");
|
||||||
|
//! let tree = parser.parse(code, None).unwrap();
|
||||||
|
//! assert!(!tree.root_node().has_error());
|
||||||
|
//! ```
|
||||||
|
//!
|
||||||
|
//! [Parser]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Parser.html
|
||||||
|
//! [tree-sitter]: https://tree-sitter.github.io/
|
||||||
|
|
||||||
|
use tree_sitter_language::LanguageFn;
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
fn tree_sitter_bruno() -> *const ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The tree-sitter [`LanguageFn`][LanguageFn] for this grammar.
|
||||||
|
///
|
||||||
|
/// [LanguageFn]: https://docs.rs/tree-sitter-language/*/tree_sitter_language/struct.LanguageFn.html
|
||||||
|
pub const LANGUAGE: LanguageFn = unsafe { LanguageFn::from_raw(tree_sitter_bruno) };
|
||||||
|
|
||||||
|
/// 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
|
||||||
|
pub const NODE_TYPES: &str = include_str!("../../src/node-types.json");
|
||||||
|
|
||||||
|
// NOTE: uncomment these to include any queries that this grammar contains:
|
||||||
|
|
||||||
|
pub const HIGHLIGHTS_QUERY: &str = include_str!("../../queries/highlights.scm");
|
||||||
|
pub const INJECTIONS_QUERY: &str = include_str!("../../queries/injections.scm");
|
||||||
|
// pub const LOCALS_QUERY: &str = include_str!("../../queries/locals.scm");
|
||||||
|
// pub const TAGS_QUERY: &str = include_str!("../../queries/tags.scm");
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
#[test]
|
||||||
|
fn test_can_load_grammar() {
|
||||||
|
let mut parser = tree_sitter::Parser::new();
|
||||||
|
parser
|
||||||
|
.set_language(&super::LANGUAGE.into())
|
||||||
|
.expect("Error loading Bruno parser");
|
||||||
|
}
|
||||||
|
}
|
||||||
16
bindings/swift/TreeSitterBruno/bruno.h
generated
Normal file
16
bindings/swift/TreeSitterBruno/bruno.h
generated
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#ifndef TREE_SITTER_BRUNO_H_
|
||||||
|
#define TREE_SITTER_BRUNO_H_
|
||||||
|
|
||||||
|
typedef struct TSLanguage TSLanguage;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
const TSLanguage *tree_sitter_bruno(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // TREE_SITTER_BRUNO_H_
|
||||||
12
bindings/swift/TreeSitterBrunoTests/TreeSitterBrunoTests.swift
generated
Normal file
12
bindings/swift/TreeSitterBrunoTests/TreeSitterBrunoTests.swift
generated
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import XCTest
|
||||||
|
import SwiftTreeSitter
|
||||||
|
import TreeSitterBruno
|
||||||
|
|
||||||
|
final class TreeSitterBrunoTests: XCTestCase {
|
||||||
|
func testCanLoadGrammar() throws {
|
||||||
|
let parser = Parser()
|
||||||
|
let language = Language(language: tree_sitter_bruno())
|
||||||
|
XCTAssertNoThrow(try parser.setLanguage(language),
|
||||||
|
"Error loading Bruno grammar")
|
||||||
|
}
|
||||||
|
}
|
||||||
156
deno.lock
Normal file
156
deno.lock
Normal file
@ -0,0 +1,156 @@
|
|||||||
|
{
|
||||||
|
"version": "4",
|
||||||
|
"specifiers": {
|
||||||
|
"npm:node-addon-api@^8.1.0": "8.3.0",
|
||||||
|
"npm:node-gyp-build@^4.8.2": "4.8.4",
|
||||||
|
"npm:prebuildify@^6.0.1": "6.0.1",
|
||||||
|
"npm:tree-sitter-cli@~0.24.3": "0.24.5"
|
||||||
|
},
|
||||||
|
"npm": {
|
||||||
|
"base64-js@1.5.1": {
|
||||||
|
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="
|
||||||
|
},
|
||||||
|
"bl@4.1.0": {
|
||||||
|
"integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==",
|
||||||
|
"dependencies": [
|
||||||
|
"buffer",
|
||||||
|
"inherits",
|
||||||
|
"readable-stream"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"buffer@5.7.1": {
|
||||||
|
"integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
|
||||||
|
"dependencies": [
|
||||||
|
"base64-js",
|
||||||
|
"ieee754"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"chownr@1.1.4": {
|
||||||
|
"integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg=="
|
||||||
|
},
|
||||||
|
"end-of-stream@1.4.4": {
|
||||||
|
"integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
|
||||||
|
"dependencies": [
|
||||||
|
"once"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"fs-constants@1.0.0": {
|
||||||
|
"integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow=="
|
||||||
|
},
|
||||||
|
"ieee754@1.2.1": {
|
||||||
|
"integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="
|
||||||
|
},
|
||||||
|
"inherits@2.0.4": {
|
||||||
|
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||||
|
},
|
||||||
|
"minimist@1.2.8": {
|
||||||
|
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA=="
|
||||||
|
},
|
||||||
|
"mkdirp-classic@0.5.3": {
|
||||||
|
"integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A=="
|
||||||
|
},
|
||||||
|
"node-abi@3.71.0": {
|
||||||
|
"integrity": "sha512-SZ40vRiy/+wRTf21hxkkEjPJZpARzUMVcJoQse2EF8qkUWbbO2z7vd5oA/H6bVH6SZQ5STGcu0KRDS7biNRfxw==",
|
||||||
|
"dependencies": [
|
||||||
|
"semver"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"node-addon-api@8.3.0": {
|
||||||
|
"integrity": "sha512-8VOpLHFrOQlAH+qA0ZzuGRlALRA6/LVh8QJldbrC4DY0hXoMP0l4Acq8TzFC018HztWiRqyCEj2aTWY2UvnJUg=="
|
||||||
|
},
|
||||||
|
"node-gyp-build@4.8.4": {
|
||||||
|
"integrity": "sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ=="
|
||||||
|
},
|
||||||
|
"npm-run-path@3.1.0": {
|
||||||
|
"integrity": "sha512-Dbl4A/VfiVGLgQv29URL9xshU8XDY1GeLy+fsaZ1AA8JDSfjvr5P5+pzRbWqRSBxk6/DW7MIh8lTM/PaGnP2kg==",
|
||||||
|
"dependencies": [
|
||||||
|
"path-key"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"once@1.4.0": {
|
||||||
|
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
|
||||||
|
"dependencies": [
|
||||||
|
"wrappy"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"path-key@3.1.1": {
|
||||||
|
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q=="
|
||||||
|
},
|
||||||
|
"prebuildify@6.0.1": {
|
||||||
|
"integrity": "sha512-8Y2oOOateom/s8dNBsGIcnm6AxPmLH4/nanQzL5lQMU+sC0CMhzARZHizwr36pUPLdvBnOkCNQzxg4djuFSgIw==",
|
||||||
|
"dependencies": [
|
||||||
|
"minimist",
|
||||||
|
"mkdirp-classic",
|
||||||
|
"node-abi",
|
||||||
|
"npm-run-path",
|
||||||
|
"pump",
|
||||||
|
"tar-fs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"pump@3.0.2": {
|
||||||
|
"integrity": "sha512-tUPXtzlGM8FE3P0ZL6DVs/3P58k9nk8/jZeQCurTJylQA8qFYzHFfhBJkuqyE0FifOsQ0uKWekiZ5g8wtr28cw==",
|
||||||
|
"dependencies": [
|
||||||
|
"end-of-stream",
|
||||||
|
"once"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"readable-stream@3.6.2": {
|
||||||
|
"integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
|
||||||
|
"dependencies": [
|
||||||
|
"inherits",
|
||||||
|
"string_decoder",
|
||||||
|
"util-deprecate"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"safe-buffer@5.2.1": {
|
||||||
|
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="
|
||||||
|
},
|
||||||
|
"semver@7.6.3": {
|
||||||
|
"integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A=="
|
||||||
|
},
|
||||||
|
"string_decoder@1.3.0": {
|
||||||
|
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
|
||||||
|
"dependencies": [
|
||||||
|
"safe-buffer"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tar-fs@2.1.1": {
|
||||||
|
"integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==",
|
||||||
|
"dependencies": [
|
||||||
|
"chownr",
|
||||||
|
"mkdirp-classic",
|
||||||
|
"pump",
|
||||||
|
"tar-stream"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tar-stream@2.2.0": {
|
||||||
|
"integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==",
|
||||||
|
"dependencies": [
|
||||||
|
"bl",
|
||||||
|
"end-of-stream",
|
||||||
|
"fs-constants",
|
||||||
|
"inherits",
|
||||||
|
"readable-stream"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tree-sitter-cli@0.24.5": {
|
||||||
|
"integrity": "sha512-8EIgV/ERQlpvk1rPSCCjxveAb6Sba8tMiBpeeL68Mueuuqr0wNfhps/I1nFm2OTnpPCUV2PS9nbzzAMoyxSQUg=="
|
||||||
|
},
|
||||||
|
"util-deprecate@1.0.2": {
|
||||||
|
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
|
||||||
|
},
|
||||||
|
"wrappy@1.0.2": {
|
||||||
|
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"workspace": {
|
||||||
|
"packageJson": {
|
||||||
|
"dependencies": [
|
||||||
|
"npm:node-addon-api@^8.1.0",
|
||||||
|
"npm:node-gyp-build@^4.8.2",
|
||||||
|
"npm:prebuildify@^6.0.1",
|
||||||
|
"npm:tree-sitter-cli@~0.24.3"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
5
go.mod
generated
Normal file
5
go.mod
generated
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
module github.com/kristoferssolo/tree-sitter-bruno
|
||||||
|
|
||||||
|
go 1.22
|
||||||
|
|
||||||
|
require github.com/tree-sitter/go-tree-sitter v0.23.1
|
||||||
129
grammar.js
Normal file
129
grammar.js
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
/**
|
||||||
|
* @file Bruno grammar for tree-sitter
|
||||||
|
* @author Kristofers Solo <dev@kristofers.xyz>
|
||||||
|
* @license MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
/// <reference types="tree-sitter-cli/dsl" />
|
||||||
|
// @ts-check
|
||||||
|
|
||||||
|
module.exports = grammar({
|
||||||
|
name: "bruno",
|
||||||
|
|
||||||
|
extras: (_) => [/\s+|(\r?\n)/],
|
||||||
|
|
||||||
|
externals: ($) => [$.rawtext],
|
||||||
|
|
||||||
|
rules: {
|
||||||
|
source_file: ($) =>
|
||||||
|
repeat(
|
||||||
|
field(
|
||||||
|
"tag",
|
||||||
|
choice(
|
||||||
|
$.meta,
|
||||||
|
$.http,
|
||||||
|
$.query,
|
||||||
|
$.headers,
|
||||||
|
$.auths,
|
||||||
|
$.bodies,
|
||||||
|
$.varsandassert,
|
||||||
|
$.script,
|
||||||
|
$.tests,
|
||||||
|
$.docs,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
meta: ($) => seq(alias("meta", $.keyword), $.dictionary),
|
||||||
|
|
||||||
|
http: ($) => seq(alias($.http_verb, $.keyword), $.dictionary),
|
||||||
|
http_verb: (_) =>
|
||||||
|
choice(
|
||||||
|
"get",
|
||||||
|
"post",
|
||||||
|
"put",
|
||||||
|
"delete",
|
||||||
|
"patch",
|
||||||
|
"options",
|
||||||
|
"head",
|
||||||
|
"connect",
|
||||||
|
"trace",
|
||||||
|
),
|
||||||
|
|
||||||
|
query: ($) => seq(alias("query", $.keyword), $.dictionary),
|
||||||
|
|
||||||
|
headers: ($) => seq(alias("headers", $.keyword), $.dictionary),
|
||||||
|
|
||||||
|
auths: ($) =>
|
||||||
|
choice(
|
||||||
|
$.authawsv4,
|
||||||
|
$.authbasic,
|
||||||
|
$.authbearer,
|
||||||
|
$.authdigest,
|
||||||
|
$.authoauth2,
|
||||||
|
),
|
||||||
|
authawsv4: ($) => seq(alias("auth:awsv4", $.keyword), $.dictionary),
|
||||||
|
authbasic: ($) => seq(alias("auth:basic", $.keyword), $.dictionary),
|
||||||
|
authbearer: ($) => seq(alias("auth:bearer", $.keyword), $.dictionary),
|
||||||
|
authdigest: ($) => seq(alias("auth:digest", $.keyword), $.dictionary),
|
||||||
|
authoauth2: ($) => seq(alias("auth:oauth2", $.keyword), $.dictionary),
|
||||||
|
|
||||||
|
bodies: ($) =>
|
||||||
|
choice(
|
||||||
|
$.bodyjson,
|
||||||
|
$.bodytext,
|
||||||
|
$.bodyxml,
|
||||||
|
$.bodysparql,
|
||||||
|
$.bodygraphql,
|
||||||
|
$.bodygraphqlvars,
|
||||||
|
$.bodyforms,
|
||||||
|
$.body,
|
||||||
|
),
|
||||||
|
bodyforms: ($) => choice($.bodyformurlencoded, $.bodyformmultipart),
|
||||||
|
body: ($) => seq(alias("body", $.keyword), $.textblock),
|
||||||
|
bodyjson: ($) => seq(alias("body:json", $.keyword), $.textblock),
|
||||||
|
bodytext: ($) => seq(alias("body:text", $.keyword), $.textblock),
|
||||||
|
bodyxml: ($) => seq(alias("body:xml", $.keyword), $.textblock),
|
||||||
|
bodysparql: ($) => seq(alias("body:sparql", $.keyword), $.textblock),
|
||||||
|
bodygraphql: ($) => seq(alias("body:graphql", $.keyword), $.textblock),
|
||||||
|
bodygraphqlvars: ($) =>
|
||||||
|
seq(alias("body:graphql:vars", $.keyword), $.textblock),
|
||||||
|
bodyformurlencoded: ($) =>
|
||||||
|
seq(alias("body:form-urlencoded", $.keyword), $.dictionary),
|
||||||
|
bodyformmultipart: ($) =>
|
||||||
|
seq(alias("body:multipart-form", $.keyword), $.dictionary),
|
||||||
|
|
||||||
|
varsandassert: ($) =>
|
||||||
|
choice($.vars, $.vars_secret, $.varsreq, $.varsres, $.assert),
|
||||||
|
vars: ($) => seq(alias("vars", $.keyword), $.dictionary),
|
||||||
|
vars_secret: ($) => seq(alias("vars:secret", $.keyword), $.array),
|
||||||
|
varsreq: ($) => seq(alias("vars:pre-request", $.keyword), $.dictionary),
|
||||||
|
varsres: ($) => seq(alias("vars:post-response", $.keyword), $.dictionary),
|
||||||
|
|
||||||
|
assert: ($) => seq(alias("assert", $.keyword), $.assert_dictionary),
|
||||||
|
|
||||||
|
script: ($) => choice($.scriptreq, $.scriptres),
|
||||||
|
scriptreq: ($) => seq(alias("script:pre-request", $.keyword), $.textblock),
|
||||||
|
scriptres: ($) =>
|
||||||
|
seq(alias("script:post-response", $.keyword), $.textblock),
|
||||||
|
|
||||||
|
tests: ($) => seq(alias("tests", $.keyword), $.textblock),
|
||||||
|
|
||||||
|
docs: ($) => seq(alias("docs", $.keyword), $.textblock),
|
||||||
|
|
||||||
|
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:]+/,
|
||||||
|
|
||||||
|
key: (_) => /[^\s\r\n:]+/,
|
||||||
|
value: (_) => /[^\r\n]*/,
|
||||||
|
},
|
||||||
|
});
|
||||||
56
package.json
Normal file
56
package.json
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
{
|
||||||
|
"name": "tree-sitter-bruno",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"description": " Bruno grammar for tree-sitter",
|
||||||
|
"repository": "github:tree-sitter/tree-sitter-bruno",
|
||||||
|
"license": "MIT",
|
||||||
|
"author": {
|
||||||
|
"name": "Kristofers Solo",
|
||||||
|
"email": "dev@kristofers.xyz"
|
||||||
|
},
|
||||||
|
"main": "bindings/node",
|
||||||
|
"types": "bindings/node",
|
||||||
|
"keywords": [
|
||||||
|
"incremental",
|
||||||
|
"parsing",
|
||||||
|
"tree-sitter",
|
||||||
|
"bruno"
|
||||||
|
],
|
||||||
|
"files": [
|
||||||
|
"grammar.js",
|
||||||
|
"binding.gyp",
|
||||||
|
"prebuilds/**",
|
||||||
|
"bindings/node/*",
|
||||||
|
"queries/*",
|
||||||
|
"src/**",
|
||||||
|
"*.wasm"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"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
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"install": "node-gyp-build",
|
||||||
|
"prestart": "tree-sitter build --wasm",
|
||||||
|
"start": "tree-sitter playground",
|
||||||
|
"test": "node --test bindings/node/*_test.js"
|
||||||
|
},
|
||||||
|
"tree-sitter": [
|
||||||
|
{
|
||||||
|
"scope": "source.bruno",
|
||||||
|
"injection-regex": "^bruno$"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
30
pyproject.toml
Normal file
30
pyproject.toml
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
[build-system]
|
||||||
|
requires = ["setuptools>=42", "wheel"]
|
||||||
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
|
[project]
|
||||||
|
name = "tree-sitter-bruno"
|
||||||
|
description = " Bruno grammar for tree-sitter"
|
||||||
|
version = "0.1.0"
|
||||||
|
keywords = ["incremental", "parsing", "tree-sitter", "bruno"]
|
||||||
|
classifiers = [
|
||||||
|
"Intended Audience :: Developers",
|
||||||
|
"License :: OSI Approved :: MIT License",
|
||||||
|
"Topic :: Software Development :: Compilers",
|
||||||
|
"Topic :: Text Processing :: Linguistic",
|
||||||
|
"Typing :: Typed",
|
||||||
|
]
|
||||||
|
authors = [{ name = "Kristofers Solo", email = "dev@kristofers.xyz" }]
|
||||||
|
requires-python = ">=3.9"
|
||||||
|
license.text = "MIT"
|
||||||
|
readme = "README.md"
|
||||||
|
|
||||||
|
[project.urls]
|
||||||
|
Homepage = "https://github.com/kristoferssolo/tree-sitter-bruno"
|
||||||
|
|
||||||
|
[project.optional-dependencies]
|
||||||
|
core = ["tree-sitter~=0.22"]
|
||||||
|
|
||||||
|
[tool.cibuildwheel]
|
||||||
|
build = "cp39-*"
|
||||||
|
build-frontend = "build"
|
||||||
18
queries/highlights.scm
Normal file
18
queries/highlights.scm
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
(keyword) @keyword
|
||||||
|
|
||||||
|
[
|
||||||
|
"{"
|
||||||
|
"}"
|
||||||
|
"["
|
||||||
|
"]"
|
||||||
|
] @punctuation.bracket
|
||||||
|
":" @punctuation.delimiter
|
||||||
|
|
||||||
|
|
||||||
|
(key) @type
|
||||||
|
[
|
||||||
|
(value)
|
||||||
|
(array_value)
|
||||||
|
] @string
|
||||||
|
|
||||||
|
(ERROR) @error
|
||||||
59
queries/injections.scm
Normal file
59
queries/injections.scm
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
((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"))
|
||||||
62
setup.py
generated
Normal file
62
setup.py
generated
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
from os.path import isdir, join
|
||||||
|
from platform import system
|
||||||
|
|
||||||
|
from setuptools import Extension, find_packages, setup
|
||||||
|
from setuptools.command.build import build
|
||||||
|
from wheel.bdist_wheel import bdist_wheel
|
||||||
|
|
||||||
|
|
||||||
|
class Build(build):
|
||||||
|
def run(self):
|
||||||
|
if isdir("queries"):
|
||||||
|
dest = join(self.build_lib, "tree_sitter_bruno", "queries")
|
||||||
|
self.copy_tree("queries", dest)
|
||||||
|
super().run()
|
||||||
|
|
||||||
|
|
||||||
|
class BdistWheel(bdist_wheel):
|
||||||
|
def get_tag(self):
|
||||||
|
python, abi, platform = super().get_tag()
|
||||||
|
if python.startswith("cp"):
|
||||||
|
python, abi = "cp39", "abi3"
|
||||||
|
return python, abi, platform
|
||||||
|
|
||||||
|
|
||||||
|
setup(
|
||||||
|
packages=find_packages("bindings/python"),
|
||||||
|
package_dir={"": "bindings/python"},
|
||||||
|
package_data={
|
||||||
|
"tree_sitter_bruno": ["*.pyi", "py.typed"],
|
||||||
|
"tree_sitter_bruno.queries": ["*.scm"],
|
||||||
|
},
|
||||||
|
ext_package="tree_sitter_bruno",
|
||||||
|
ext_modules=[
|
||||||
|
Extension(
|
||||||
|
name="_binding",
|
||||||
|
sources=[
|
||||||
|
"bindings/python/tree_sitter_bruno/binding.c",
|
||||||
|
"src/parser.c",
|
||||||
|
"src/scanner.c",
|
||||||
|
],
|
||||||
|
extra_compile_args=[
|
||||||
|
"-std=c11",
|
||||||
|
"-fvisibility=hidden",
|
||||||
|
] if system() != "Windows" else [
|
||||||
|
"/std:c11",
|
||||||
|
"/utf-8",
|
||||||
|
],
|
||||||
|
define_macros=[
|
||||||
|
("Py_LIMITED_API", "0x03090000"),
|
||||||
|
("PY_SSIZE_T_CLEAN", None),
|
||||||
|
("TREE_SITTER_HIDE_SYMBOLS", None),
|
||||||
|
],
|
||||||
|
include_dirs=["src"],
|
||||||
|
py_limited_api=True,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
cmdclass={
|
||||||
|
"build": Build,
|
||||||
|
"bdist_wheel": BdistWheel
|
||||||
|
},
|
||||||
|
zip_safe=False
|
||||||
|
)
|
||||||
866
src/grammar.json
generated
Normal file
866
src/grammar.json
generated
Normal file
@ -0,0 +1,866 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://tree-sitter.github.io/tree-sitter/assets/schemas/grammar.schema.json",
|
||||||
|
"name": "bruno",
|
||||||
|
"rules": {
|
||||||
|
"source_file": {
|
||||||
|
"type": "REPEAT",
|
||||||
|
"content": {
|
||||||
|
"type": "FIELD",
|
||||||
|
"name": "tag",
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"meta": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "meta"
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "keyword"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "dictionary"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"http": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "http_verb"
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "keyword"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "dictionary"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"http_verb": {
|
||||||
|
"type": "CHOICE",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "get"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "post"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "put"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "delete"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "patch"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "options"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "head"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "connect"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "trace"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"query": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "query"
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "keyword"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "dictionary"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"headers": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "headers"
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "keyword"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "dictionary"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"auths": {
|
||||||
|
"type": "CHOICE",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "authawsv4"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "authbasic"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "authbearer"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "authdigest"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "authoauth2"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"authawsv4": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "auth:awsv4"
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "keyword"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "dictionary"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"authbasic": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "auth:basic"
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "keyword"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "dictionary"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"authbearer": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "auth:bearer"
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "keyword"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "dictionary"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"authdigest": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "auth:digest"
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "keyword"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "dictionary"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"authoauth2": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "auth:oauth2"
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "keyword"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "dictionary"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"bodies": {
|
||||||
|
"type": "CHOICE",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "bodyjson"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "bodytext"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "bodyxml"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "bodysparql"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "bodygraphql"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "bodygraphqlvars"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "bodyforms"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "body"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"bodyforms": {
|
||||||
|
"type": "CHOICE",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "bodyformurlencoded"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "bodyformmultipart"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"body": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "body"
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "keyword"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "textblock"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"bodyjson": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "body:json"
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "keyword"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "textblock"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"bodytext": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "body:text"
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "keyword"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "textblock"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"bodyxml": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "body:xml"
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "keyword"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "textblock"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"bodysparql": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "body:sparql"
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "keyword"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "textblock"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"bodygraphql": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "body:graphql"
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "keyword"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "textblock"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"bodygraphqlvars": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "body:graphql:vars"
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "keyword"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "textblock"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"bodyformurlencoded": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "body:form-urlencoded"
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "keyword"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "dictionary"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"bodyformmultipart": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "body:multipart-form"
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "keyword"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "dictionary"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"varsandassert": {
|
||||||
|
"type": "CHOICE",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "vars"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "vars_secret"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "varsreq"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "varsres"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "assert"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"vars": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "vars"
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "keyword"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "dictionary"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"vars_secret": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "vars:secret"
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "keyword"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "array"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"varsreq": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "vars:pre-request"
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "keyword"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "dictionary"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"varsres": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "vars:post-response"
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "keyword"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "dictionary"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"assert": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "assert"
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "keyword"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "assert_dictionary"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"script": {
|
||||||
|
"type": "CHOICE",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "scriptreq"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "scriptres"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"scriptreq": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "script:pre-request"
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "keyword"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "textblock"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"scriptres": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "script:post-response"
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "keyword"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "textblock"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"tests": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "tests"
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "keyword"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "textblock"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"docs": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "ALIAS",
|
||||||
|
"content": {
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "docs"
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "keyword"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "textblock"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"textblock": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "{"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "CHOICE",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "rawtext"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "BLANK"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"array": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "["
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "REPEAT",
|
||||||
|
"content": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "array_value"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "CHOICE",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": ","
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "BLANK"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "]"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"array_value": {
|
||||||
|
"type": "PATTERN",
|
||||||
|
"value": "[^\\r\\n\\s\\t\\[\\],]+"
|
||||||
|
},
|
||||||
|
"dictionary": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "{"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "REPEAT",
|
||||||
|
"content": {
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "dictionary_pair"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"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": {
|
||||||
|
"type": "PATTERN",
|
||||||
|
"value": "[^\\r\\n:]+"
|
||||||
|
},
|
||||||
|
"key": {
|
||||||
|
"type": "PATTERN",
|
||||||
|
"value": "[^\\s\\r\\n:]+"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"type": "PATTERN",
|
||||||
|
"value": "[^\\r\\n]*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"extras": [
|
||||||
|
{
|
||||||
|
"type": "PATTERN",
|
||||||
|
"value": "\\s+|(\\r?\\n)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"conflicts": [],
|
||||||
|
"precedences": [],
|
||||||
|
"externals": [
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "rawtext"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"inline": [],
|
||||||
|
"supertypes": []
|
||||||
|
}
|
||||||
894
src/node-types.json
generated
Normal file
894
src/node-types.json
generated
Normal file
@ -0,0 +1,894 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"type": "array",
|
||||||
|
"named": true,
|
||||||
|
"fields": {},
|
||||||
|
"children": {
|
||||||
|
"multiple": true,
|
||||||
|
"required": false,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "array_value",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "assert",
|
||||||
|
"named": true,
|
||||||
|
"fields": {},
|
||||||
|
"children": {
|
||||||
|
"multiple": true,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "assert_dictionary",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "keyword",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "assert_dictionary",
|
||||||
|
"named": true,
|
||||||
|
"fields": {},
|
||||||
|
"children": {
|
||||||
|
"multiple": true,
|
||||||
|
"required": false,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "assert_dictionary_pair",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "assert_dictionary_pair",
|
||||||
|
"named": true,
|
||||||
|
"fields": {},
|
||||||
|
"children": {
|
||||||
|
"multiple": true,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "assert_key",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "value",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "authawsv4",
|
||||||
|
"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,
|
||||||
|
"fields": {},
|
||||||
|
"children": {
|
||||||
|
"multiple": false,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "authawsv4",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "authbasic",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "authbearer",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "authdigest",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "authoauth2",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bodies",
|
||||||
|
"named": true,
|
||||||
|
"fields": {},
|
||||||
|
"children": {
|
||||||
|
"multiple": false,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "body",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bodyforms",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bodygraphql",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bodygraphqlvars",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bodyjson",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bodysparql",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bodytext",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bodyxml",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "body",
|
||||||
|
"named": true,
|
||||||
|
"fields": {},
|
||||||
|
"children": {
|
||||||
|
"multiple": true,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "keyword",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "textblock",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bodyformmultipart",
|
||||||
|
"named": true,
|
||||||
|
"fields": {},
|
||||||
|
"children": {
|
||||||
|
"multiple": true,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "dictionary",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "keyword",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bodyforms",
|
||||||
|
"named": true,
|
||||||
|
"fields": {},
|
||||||
|
"children": {
|
||||||
|
"multiple": false,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "bodyformmultipart",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bodyformurlencoded",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bodyformurlencoded",
|
||||||
|
"named": true,
|
||||||
|
"fields": {},
|
||||||
|
"children": {
|
||||||
|
"multiple": true,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "dictionary",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "keyword",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bodygraphql",
|
||||||
|
"named": true,
|
||||||
|
"fields": {},
|
||||||
|
"children": {
|
||||||
|
"multiple": true,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "keyword",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "textblock",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bodygraphqlvars",
|
||||||
|
"named": true,
|
||||||
|
"fields": {},
|
||||||
|
"children": {
|
||||||
|
"multiple": true,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "keyword",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "textblock",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bodyjson",
|
||||||
|
"named": true,
|
||||||
|
"fields": {},
|
||||||
|
"children": {
|
||||||
|
"multiple": true,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "keyword",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "textblock",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bodysparql",
|
||||||
|
"named": true,
|
||||||
|
"fields": {},
|
||||||
|
"children": {
|
||||||
|
"multiple": true,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "keyword",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "textblock",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bodytext",
|
||||||
|
"named": true,
|
||||||
|
"fields": {},
|
||||||
|
"children": {
|
||||||
|
"multiple": true,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "keyword",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "textblock",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "bodyxml",
|
||||||
|
"named": true,
|
||||||
|
"fields": {},
|
||||||
|
"children": {
|
||||||
|
"multiple": true,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "keyword",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "textblock",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "dictionary",
|
||||||
|
"named": true,
|
||||||
|
"fields": {},
|
||||||
|
"children": {
|
||||||
|
"multiple": true,
|
||||||
|
"required": false,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "dictionary_pair",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "dictionary_pair",
|
||||||
|
"named": true,
|
||||||
|
"fields": {},
|
||||||
|
"children": {
|
||||||
|
"multiple": true,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "key",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "value",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "docs",
|
||||||
|
"named": true,
|
||||||
|
"fields": {},
|
||||||
|
"children": {
|
||||||
|
"multiple": true,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "keyword",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "textblock",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "headers",
|
||||||
|
"named": true,
|
||||||
|
"fields": {},
|
||||||
|
"children": {
|
||||||
|
"multiple": true,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "dictionary",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "keyword",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "http",
|
||||||
|
"named": true,
|
||||||
|
"fields": {},
|
||||||
|
"children": {
|
||||||
|
"multiple": true,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "dictionary",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "keyword",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "keyword",
|
||||||
|
"named": true,
|
||||||
|
"fields": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "meta",
|
||||||
|
"named": true,
|
||||||
|
"fields": {},
|
||||||
|
"children": {
|
||||||
|
"multiple": true,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "dictionary",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "keyword",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "query",
|
||||||
|
"named": true,
|
||||||
|
"fields": {},
|
||||||
|
"children": {
|
||||||
|
"multiple": true,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "dictionary",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "keyword",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "script",
|
||||||
|
"named": true,
|
||||||
|
"fields": {},
|
||||||
|
"children": {
|
||||||
|
"multiple": false,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "scriptreq",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "scriptres",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "scriptreq",
|
||||||
|
"named": true,
|
||||||
|
"fields": {},
|
||||||
|
"children": {
|
||||||
|
"multiple": true,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "keyword",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "textblock",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "scriptres",
|
||||||
|
"named": true,
|
||||||
|
"fields": {},
|
||||||
|
"children": {
|
||||||
|
"multiple": true,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "keyword",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "textblock",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "source_file",
|
||||||
|
"named": true,
|
||||||
|
"root": true,
|
||||||
|
"fields": {
|
||||||
|
"tag": {
|
||||||
|
"multiple": true,
|
||||||
|
"required": false,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "auths",
|
||||||
|
"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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "tests",
|
||||||
|
"named": true,
|
||||||
|
"fields": {},
|
||||||
|
"children": {
|
||||||
|
"multiple": true,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "keyword",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "textblock",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "textblock",
|
||||||
|
"named": true,
|
||||||
|
"fields": {},
|
||||||
|
"children": {
|
||||||
|
"multiple": false,
|
||||||
|
"required": false,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "rawtext",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "vars",
|
||||||
|
"named": true,
|
||||||
|
"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": {
|
||||||
|
"multiple": false,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "assert",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "vars",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "vars_secret",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "varsreq",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "varsres",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "varsreq",
|
||||||
|
"named": true,
|
||||||
|
"fields": {},
|
||||||
|
"children": {
|
||||||
|
"multiple": true,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "dictionary",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "keyword",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "varsres",
|
||||||
|
"named": true,
|
||||||
|
"fields": {},
|
||||||
|
"children": {
|
||||||
|
"multiple": true,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "dictionary",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "keyword",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": ",",
|
||||||
|
"named": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": ":",
|
||||||
|
"named": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "[",
|
||||||
|
"named": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "]",
|
||||||
|
"named": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "array_value",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "assert_key",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "connect",
|
||||||
|
"named": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "delete",
|
||||||
|
"named": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "get",
|
||||||
|
"named": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "head",
|
||||||
|
"named": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "key",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "options",
|
||||||
|
"named": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "patch",
|
||||||
|
"named": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "post",
|
||||||
|
"named": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "put",
|
||||||
|
"named": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "rawtext",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "trace",
|
||||||
|
"named": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "value",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "{",
|
||||||
|
"named": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "}",
|
||||||
|
"named": false
|
||||||
|
}
|
||||||
|
]
|
||||||
4192
src/parser.c
generated
Normal file
4192
src/parser.c
generated
Normal file
File diff suppressed because it is too large
Load Diff
50
src/scanner.c
Normal file
50
src/scanner.c
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
#include "tree_sitter/parser.h"
|
||||||
|
|
||||||
|
enum TokenType {
|
||||||
|
RAW_TEXT,
|
||||||
|
};
|
||||||
|
|
||||||
|
void *tree_sitter_bruno_external_scanner_create() {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void tree_sitter_bruno_external_scanner_destroy(void *p) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void tree_sitter_bruno_external_scanner_reset(void *p) {
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned tree_sitter_bruno_external_scanner_serialize(void *p, char *buffer) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void tree_sitter_bruno_external_scanner_deserialize(void *p, const char *b, unsigned n) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void advance(TSLexer *lexer) {
|
||||||
|
lexer->advance(lexer, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool tree_sitter_bruno_external_scanner_scan(void *payload, TSLexer *lexer, const bool *valid_symbols) {
|
||||||
|
if (valid_symbols[RAW_TEXT]) {
|
||||||
|
// 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;
|
||||||
|
for (bool has_content = false;; has_content = true) {
|
||||||
|
lexer->mark_end(lexer);
|
||||||
|
|
||||||
|
switch (lexer->lookahead) {
|
||||||
|
case '\n':
|
||||||
|
advance(lexer);
|
||||||
|
if (lexer->lookahead == '}') return has_content;
|
||||||
|
break;
|
||||||
|
case '\0': return false;
|
||||||
|
default: advance(lexer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
54
src/tree_sitter/alloc.h
generated
Normal file
54
src/tree_sitter/alloc.h
generated
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
#ifndef TREE_SITTER_ALLOC_H_
|
||||||
|
#define TREE_SITTER_ALLOC_H_
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
// Allow clients to override allocation functions
|
||||||
|
#ifdef TREE_SITTER_REUSE_ALLOCATOR
|
||||||
|
|
||||||
|
extern void *(*ts_current_malloc)(size_t size);
|
||||||
|
extern void *(*ts_current_calloc)(size_t count, size_t size);
|
||||||
|
extern void *(*ts_current_realloc)(void *ptr, size_t size);
|
||||||
|
extern void (*ts_current_free)(void *ptr);
|
||||||
|
|
||||||
|
#ifndef ts_malloc
|
||||||
|
#define ts_malloc ts_current_malloc
|
||||||
|
#endif
|
||||||
|
#ifndef ts_calloc
|
||||||
|
#define ts_calloc ts_current_calloc
|
||||||
|
#endif
|
||||||
|
#ifndef ts_realloc
|
||||||
|
#define ts_realloc ts_current_realloc
|
||||||
|
#endif
|
||||||
|
#ifndef ts_free
|
||||||
|
#define ts_free ts_current_free
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#ifndef ts_malloc
|
||||||
|
#define ts_malloc malloc
|
||||||
|
#endif
|
||||||
|
#ifndef ts_calloc
|
||||||
|
#define ts_calloc calloc
|
||||||
|
#endif
|
||||||
|
#ifndef ts_realloc
|
||||||
|
#define ts_realloc realloc
|
||||||
|
#endif
|
||||||
|
#ifndef ts_free
|
||||||
|
#define ts_free free
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // TREE_SITTER_ALLOC_H_
|
||||||
290
src/tree_sitter/array.h
generated
Normal file
290
src/tree_sitter/array.h
generated
Normal file
@ -0,0 +1,290 @@
|
|||||||
|
#ifndef TREE_SITTER_ARRAY_H_
|
||||||
|
#define TREE_SITTER_ARRAY_H_
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "./alloc.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(disable : 4101)
|
||||||
|
#elif defined(__GNUC__) || defined(__clang__)
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wunused-variable"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define Array(T) \
|
||||||
|
struct { \
|
||||||
|
T *contents; \
|
||||||
|
uint32_t size; \
|
||||||
|
uint32_t capacity; \
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Initialize an array.
|
||||||
|
#define array_init(self) \
|
||||||
|
((self)->size = 0, (self)->capacity = 0, (self)->contents = NULL)
|
||||||
|
|
||||||
|
/// Create an empty array.
|
||||||
|
#define array_new() \
|
||||||
|
{ NULL, 0, 0 }
|
||||||
|
|
||||||
|
/// Get a pointer to the element at a given `index` in the array.
|
||||||
|
#define array_get(self, _index) \
|
||||||
|
(assert((uint32_t)(_index) < (self)->size), &(self)->contents[_index])
|
||||||
|
|
||||||
|
/// Get a pointer to the first element in the array.
|
||||||
|
#define array_front(self) array_get(self, 0)
|
||||||
|
|
||||||
|
/// Get a pointer to the last element in the array.
|
||||||
|
#define array_back(self) array_get(self, (self)->size - 1)
|
||||||
|
|
||||||
|
/// Clear the array, setting its size to zero. Note that this does not free any
|
||||||
|
/// memory allocated for the array's contents.
|
||||||
|
#define array_clear(self) ((self)->size = 0)
|
||||||
|
|
||||||
|
/// Reserve `new_capacity` elements of space in the array. If `new_capacity` is
|
||||||
|
/// less than the array's current capacity, this function has no effect.
|
||||||
|
#define array_reserve(self, new_capacity) \
|
||||||
|
_array__reserve((Array *)(self), array_elem_size(self), new_capacity)
|
||||||
|
|
||||||
|
/// Free any memory allocated for this array. Note that this does not free any
|
||||||
|
/// memory allocated for the array's contents.
|
||||||
|
#define array_delete(self) _array__delete((Array *)(self))
|
||||||
|
|
||||||
|
/// Push a new `element` onto the end of the array.
|
||||||
|
#define array_push(self, element) \
|
||||||
|
(_array__grow((Array *)(self), 1, array_elem_size(self)), \
|
||||||
|
(self)->contents[(self)->size++] = (element))
|
||||||
|
|
||||||
|
/// Increase the array's size by `count` elements.
|
||||||
|
/// New elements are zero-initialized.
|
||||||
|
#define array_grow_by(self, count) \
|
||||||
|
do { \
|
||||||
|
if ((count) == 0) break; \
|
||||||
|
_array__grow((Array *)(self), count, array_elem_size(self)); \
|
||||||
|
memset((self)->contents + (self)->size, 0, (count) * array_elem_size(self)); \
|
||||||
|
(self)->size += (count); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
/// Append all elements from one array to the end of another.
|
||||||
|
#define array_push_all(self, other) \
|
||||||
|
array_extend((self), (other)->size, (other)->contents)
|
||||||
|
|
||||||
|
/// Append `count` elements to the end of the array, reading their values from the
|
||||||
|
/// `contents` pointer.
|
||||||
|
#define array_extend(self, count, contents) \
|
||||||
|
_array__splice( \
|
||||||
|
(Array *)(self), array_elem_size(self), (self)->size, \
|
||||||
|
0, count, contents \
|
||||||
|
)
|
||||||
|
|
||||||
|
/// Remove `old_count` elements from the array starting at the given `index`. At
|
||||||
|
/// the same index, insert `new_count` new elements, reading their values from the
|
||||||
|
/// `new_contents` pointer.
|
||||||
|
#define array_splice(self, _index, old_count, new_count, new_contents) \
|
||||||
|
_array__splice( \
|
||||||
|
(Array *)(self), array_elem_size(self), _index, \
|
||||||
|
old_count, new_count, new_contents \
|
||||||
|
)
|
||||||
|
|
||||||
|
/// Insert one `element` into the array at the given `index`.
|
||||||
|
#define array_insert(self, _index, element) \
|
||||||
|
_array__splice((Array *)(self), array_elem_size(self), _index, 0, 1, &(element))
|
||||||
|
|
||||||
|
/// Remove one element from the array at the given `index`.
|
||||||
|
#define array_erase(self, _index) \
|
||||||
|
_array__erase((Array *)(self), array_elem_size(self), _index)
|
||||||
|
|
||||||
|
/// Pop the last element off the array, returning the element by value.
|
||||||
|
#define array_pop(self) ((self)->contents[--(self)->size])
|
||||||
|
|
||||||
|
/// Assign the contents of one array to another, reallocating if necessary.
|
||||||
|
#define array_assign(self, other) \
|
||||||
|
_array__assign((Array *)(self), (const Array *)(other), array_elem_size(self))
|
||||||
|
|
||||||
|
/// Swap one array with another
|
||||||
|
#define array_swap(self, other) \
|
||||||
|
_array__swap((Array *)(self), (Array *)(other))
|
||||||
|
|
||||||
|
/// Get the size of the array contents
|
||||||
|
#define array_elem_size(self) (sizeof *(self)->contents)
|
||||||
|
|
||||||
|
/// Search a sorted array for a given `needle` value, using the given `compare`
|
||||||
|
/// callback to determine the order.
|
||||||
|
///
|
||||||
|
/// If an existing element is found to be equal to `needle`, then the `index`
|
||||||
|
/// out-parameter is set to the existing value's index, and the `exists`
|
||||||
|
/// out-parameter is set to true. Otherwise, `index` is set to an index where
|
||||||
|
/// `needle` should be inserted in order to preserve the sorting, and `exists`
|
||||||
|
/// is set to false.
|
||||||
|
#define array_search_sorted_with(self, compare, needle, _index, _exists) \
|
||||||
|
_array__search_sorted(self, 0, compare, , needle, _index, _exists)
|
||||||
|
|
||||||
|
/// Search a sorted array for a given `needle` value, using integer comparisons
|
||||||
|
/// of a given struct field (specified with a leading dot) to determine the order.
|
||||||
|
///
|
||||||
|
/// See also `array_search_sorted_with`.
|
||||||
|
#define array_search_sorted_by(self, field, needle, _index, _exists) \
|
||||||
|
_array__search_sorted(self, 0, _compare_int, field, needle, _index, _exists)
|
||||||
|
|
||||||
|
/// Insert a given `value` into a sorted array, using the given `compare`
|
||||||
|
/// callback to determine the order.
|
||||||
|
#define array_insert_sorted_with(self, compare, value) \
|
||||||
|
do { \
|
||||||
|
unsigned _index, _exists; \
|
||||||
|
array_search_sorted_with(self, compare, &(value), &_index, &_exists); \
|
||||||
|
if (!_exists) array_insert(self, _index, value); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
/// Insert a given `value` into a sorted array, using integer comparisons of
|
||||||
|
/// a given struct field (specified with a leading dot) to determine the order.
|
||||||
|
///
|
||||||
|
/// See also `array_search_sorted_by`.
|
||||||
|
#define array_insert_sorted_by(self, field, value) \
|
||||||
|
do { \
|
||||||
|
unsigned _index, _exists; \
|
||||||
|
array_search_sorted_by(self, field, (value) field, &_index, &_exists); \
|
||||||
|
if (!_exists) array_insert(self, _index, value); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
// Private
|
||||||
|
|
||||||
|
typedef Array(void) Array;
|
||||||
|
|
||||||
|
/// This is not what you're looking for, see `array_delete`.
|
||||||
|
static inline void _array__delete(Array *self) {
|
||||||
|
if (self->contents) {
|
||||||
|
ts_free(self->contents);
|
||||||
|
self->contents = NULL;
|
||||||
|
self->size = 0;
|
||||||
|
self->capacity = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// This is not what you're looking for, see `array_erase`.
|
||||||
|
static inline void _array__erase(Array *self, size_t element_size,
|
||||||
|
uint32_t index) {
|
||||||
|
assert(index < self->size);
|
||||||
|
char *contents = (char *)self->contents;
|
||||||
|
memmove(contents + index * element_size, contents + (index + 1) * element_size,
|
||||||
|
(self->size - index - 1) * element_size);
|
||||||
|
self->size--;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// This is not what you're looking for, see `array_reserve`.
|
||||||
|
static inline void _array__reserve(Array *self, size_t element_size, uint32_t new_capacity) {
|
||||||
|
if (new_capacity > self->capacity) {
|
||||||
|
if (self->contents) {
|
||||||
|
self->contents = ts_realloc(self->contents, new_capacity * element_size);
|
||||||
|
} else {
|
||||||
|
self->contents = ts_malloc(new_capacity * element_size);
|
||||||
|
}
|
||||||
|
self->capacity = new_capacity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// This is not what you're looking for, see `array_assign`.
|
||||||
|
static inline void _array__assign(Array *self, const Array *other, size_t element_size) {
|
||||||
|
_array__reserve(self, element_size, other->size);
|
||||||
|
self->size = other->size;
|
||||||
|
memcpy(self->contents, other->contents, self->size * element_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// This is not what you're looking for, see `array_swap`.
|
||||||
|
static inline void _array__swap(Array *self, Array *other) {
|
||||||
|
Array swap = *other;
|
||||||
|
*other = *self;
|
||||||
|
*self = swap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// This is not what you're looking for, see `array_push` or `array_grow_by`.
|
||||||
|
static inline void _array__grow(Array *self, uint32_t count, size_t element_size) {
|
||||||
|
uint32_t new_size = self->size + count;
|
||||||
|
if (new_size > self->capacity) {
|
||||||
|
uint32_t new_capacity = self->capacity * 2;
|
||||||
|
if (new_capacity < 8) new_capacity = 8;
|
||||||
|
if (new_capacity < new_size) new_capacity = new_size;
|
||||||
|
_array__reserve(self, element_size, new_capacity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// This is not what you're looking for, see `array_splice`.
|
||||||
|
static inline void _array__splice(Array *self, size_t element_size,
|
||||||
|
uint32_t index, uint32_t old_count,
|
||||||
|
uint32_t new_count, const void *elements) {
|
||||||
|
uint32_t new_size = self->size + new_count - old_count;
|
||||||
|
uint32_t old_end = index + old_count;
|
||||||
|
uint32_t new_end = index + new_count;
|
||||||
|
assert(old_end <= self->size);
|
||||||
|
|
||||||
|
_array__reserve(self, element_size, new_size);
|
||||||
|
|
||||||
|
char *contents = (char *)self->contents;
|
||||||
|
if (self->size > old_end) {
|
||||||
|
memmove(
|
||||||
|
contents + new_end * element_size,
|
||||||
|
contents + old_end * element_size,
|
||||||
|
(self->size - old_end) * element_size
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (new_count > 0) {
|
||||||
|
if (elements) {
|
||||||
|
memcpy(
|
||||||
|
(contents + index * element_size),
|
||||||
|
elements,
|
||||||
|
new_count * element_size
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
memset(
|
||||||
|
(contents + index * element_size),
|
||||||
|
0,
|
||||||
|
new_count * element_size
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self->size += new_count - old_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A binary search routine, based on Rust's `std::slice::binary_search_by`.
|
||||||
|
/// This is not what you're looking for, see `array_search_sorted_with` or `array_search_sorted_by`.
|
||||||
|
#define _array__search_sorted(self, start, compare, suffix, needle, _index, _exists) \
|
||||||
|
do { \
|
||||||
|
*(_index) = start; \
|
||||||
|
*(_exists) = false; \
|
||||||
|
uint32_t size = (self)->size - *(_index); \
|
||||||
|
if (size == 0) break; \
|
||||||
|
int comparison; \
|
||||||
|
while (size > 1) { \
|
||||||
|
uint32_t half_size = size / 2; \
|
||||||
|
uint32_t mid_index = *(_index) + half_size; \
|
||||||
|
comparison = compare(&((self)->contents[mid_index] suffix), (needle)); \
|
||||||
|
if (comparison <= 0) *(_index) = mid_index; \
|
||||||
|
size -= half_size; \
|
||||||
|
} \
|
||||||
|
comparison = compare(&((self)->contents[*(_index)] suffix), (needle)); \
|
||||||
|
if (comparison == 0) *(_exists) = true; \
|
||||||
|
else if (comparison < 0) *(_index) += 1; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
/// Helper macro for the `_sorted_by` routines below. This takes the left (existing)
|
||||||
|
/// parameter by reference in order to work with the generic sorting function above.
|
||||||
|
#define _compare_int(a, b) ((int)*(a) - (int)(b))
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(default : 4101)
|
||||||
|
#elif defined(__GNUC__) || defined(__clang__)
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // TREE_SITTER_ARRAY_H_
|
||||||
266
src/tree_sitter/parser.h
generated
Normal file
266
src/tree_sitter/parser.h
generated
Normal file
@ -0,0 +1,266 @@
|
|||||||
|
#ifndef TREE_SITTER_PARSER_H_
|
||||||
|
#define TREE_SITTER_PARSER_H_
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#define ts_builtin_sym_error ((TSSymbol)-1)
|
||||||
|
#define ts_builtin_sym_end 0
|
||||||
|
#define TREE_SITTER_SERIALIZATION_BUFFER_SIZE 1024
|
||||||
|
|
||||||
|
#ifndef TREE_SITTER_API_H_
|
||||||
|
typedef uint16_t TSStateId;
|
||||||
|
typedef uint16_t TSSymbol;
|
||||||
|
typedef uint16_t TSFieldId;
|
||||||
|
typedef struct TSLanguage TSLanguage;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
TSFieldId field_id;
|
||||||
|
uint8_t child_index;
|
||||||
|
bool inherited;
|
||||||
|
} TSFieldMapEntry;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint16_t index;
|
||||||
|
uint16_t length;
|
||||||
|
} TSFieldMapSlice;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
bool visible;
|
||||||
|
bool named;
|
||||||
|
bool supertype;
|
||||||
|
} TSSymbolMetadata;
|
||||||
|
|
||||||
|
typedef struct TSLexer TSLexer;
|
||||||
|
|
||||||
|
struct TSLexer {
|
||||||
|
int32_t lookahead;
|
||||||
|
TSSymbol result_symbol;
|
||||||
|
void (*advance)(TSLexer *, bool);
|
||||||
|
void (*mark_end)(TSLexer *);
|
||||||
|
uint32_t (*get_column)(TSLexer *);
|
||||||
|
bool (*is_at_included_range_start)(const TSLexer *);
|
||||||
|
bool (*eof)(const TSLexer *);
|
||||||
|
void (*log)(const TSLexer *, const char *, ...);
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
TSParseActionTypeShift,
|
||||||
|
TSParseActionTypeReduce,
|
||||||
|
TSParseActionTypeAccept,
|
||||||
|
TSParseActionTypeRecover,
|
||||||
|
} TSParseActionType;
|
||||||
|
|
||||||
|
typedef union {
|
||||||
|
struct {
|
||||||
|
uint8_t type;
|
||||||
|
TSStateId state;
|
||||||
|
bool extra;
|
||||||
|
bool repetition;
|
||||||
|
} shift;
|
||||||
|
struct {
|
||||||
|
uint8_t type;
|
||||||
|
uint8_t child_count;
|
||||||
|
TSSymbol symbol;
|
||||||
|
int16_t dynamic_precedence;
|
||||||
|
uint16_t production_id;
|
||||||
|
} reduce;
|
||||||
|
uint8_t type;
|
||||||
|
} TSParseAction;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint16_t lex_state;
|
||||||
|
uint16_t external_lex_state;
|
||||||
|
} TSLexMode;
|
||||||
|
|
||||||
|
typedef union {
|
||||||
|
TSParseAction action;
|
||||||
|
struct {
|
||||||
|
uint8_t count;
|
||||||
|
bool reusable;
|
||||||
|
} entry;
|
||||||
|
} TSParseActionEntry;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int32_t start;
|
||||||
|
int32_t end;
|
||||||
|
} TSCharacterRange;
|
||||||
|
|
||||||
|
struct TSLanguage {
|
||||||
|
uint32_t version;
|
||||||
|
uint32_t symbol_count;
|
||||||
|
uint32_t alias_count;
|
||||||
|
uint32_t token_count;
|
||||||
|
uint32_t external_token_count;
|
||||||
|
uint32_t state_count;
|
||||||
|
uint32_t large_state_count;
|
||||||
|
uint32_t production_id_count;
|
||||||
|
uint32_t field_count;
|
||||||
|
uint16_t max_alias_sequence_length;
|
||||||
|
const uint16_t *parse_table;
|
||||||
|
const uint16_t *small_parse_table;
|
||||||
|
const uint32_t *small_parse_table_map;
|
||||||
|
const TSParseActionEntry *parse_actions;
|
||||||
|
const char * const *symbol_names;
|
||||||
|
const char * const *field_names;
|
||||||
|
const TSFieldMapSlice *field_map_slices;
|
||||||
|
const TSFieldMapEntry *field_map_entries;
|
||||||
|
const TSSymbolMetadata *symbol_metadata;
|
||||||
|
const TSSymbol *public_symbol_map;
|
||||||
|
const uint16_t *alias_map;
|
||||||
|
const TSSymbol *alias_sequences;
|
||||||
|
const TSLexMode *lex_modes;
|
||||||
|
bool (*lex_fn)(TSLexer *, TSStateId);
|
||||||
|
bool (*keyword_lex_fn)(TSLexer *, TSStateId);
|
||||||
|
TSSymbol keyword_capture_token;
|
||||||
|
struct {
|
||||||
|
const bool *states;
|
||||||
|
const TSSymbol *symbol_map;
|
||||||
|
void *(*create)(void);
|
||||||
|
void (*destroy)(void *);
|
||||||
|
bool (*scan)(void *, TSLexer *, const bool *symbol_whitelist);
|
||||||
|
unsigned (*serialize)(void *, char *);
|
||||||
|
void (*deserialize)(void *, const char *, unsigned);
|
||||||
|
} external_scanner;
|
||||||
|
const TSStateId *primary_state_ids;
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline bool set_contains(TSCharacterRange *ranges, uint32_t len, int32_t lookahead) {
|
||||||
|
uint32_t index = 0;
|
||||||
|
uint32_t size = len - index;
|
||||||
|
while (size > 1) {
|
||||||
|
uint32_t half_size = size / 2;
|
||||||
|
uint32_t mid_index = index + half_size;
|
||||||
|
TSCharacterRange *range = &ranges[mid_index];
|
||||||
|
if (lookahead >= range->start && lookahead <= range->end) {
|
||||||
|
return true;
|
||||||
|
} else if (lookahead > range->end) {
|
||||||
|
index = mid_index;
|
||||||
|
}
|
||||||
|
size -= half_size;
|
||||||
|
}
|
||||||
|
TSCharacterRange *range = &ranges[index];
|
||||||
|
return (lookahead >= range->start && lookahead <= range->end);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Lexer Macros
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#define UNUSED __pragma(warning(suppress : 4101))
|
||||||
|
#else
|
||||||
|
#define UNUSED __attribute__((unused))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define START_LEXER() \
|
||||||
|
bool result = false; \
|
||||||
|
bool skip = false; \
|
||||||
|
UNUSED \
|
||||||
|
bool eof = false; \
|
||||||
|
int32_t lookahead; \
|
||||||
|
goto start; \
|
||||||
|
next_state: \
|
||||||
|
lexer->advance(lexer, skip); \
|
||||||
|
start: \
|
||||||
|
skip = false; \
|
||||||
|
lookahead = lexer->lookahead;
|
||||||
|
|
||||||
|
#define ADVANCE(state_value) \
|
||||||
|
{ \
|
||||||
|
state = state_value; \
|
||||||
|
goto next_state; \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define ADVANCE_MAP(...) \
|
||||||
|
{ \
|
||||||
|
static const uint16_t map[] = { __VA_ARGS__ }; \
|
||||||
|
for (uint32_t i = 0; i < sizeof(map) / sizeof(map[0]); i += 2) { \
|
||||||
|
if (map[i] == lookahead) { \
|
||||||
|
state = map[i + 1]; \
|
||||||
|
goto next_state; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define SKIP(state_value) \
|
||||||
|
{ \
|
||||||
|
skip = true; \
|
||||||
|
state = state_value; \
|
||||||
|
goto next_state; \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define ACCEPT_TOKEN(symbol_value) \
|
||||||
|
result = true; \
|
||||||
|
lexer->result_symbol = symbol_value; \
|
||||||
|
lexer->mark_end(lexer);
|
||||||
|
|
||||||
|
#define END_STATE() return result;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Parse Table Macros
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define SMALL_STATE(id) ((id) - LARGE_STATE_COUNT)
|
||||||
|
|
||||||
|
#define STATE(id) id
|
||||||
|
|
||||||
|
#define ACTIONS(id) id
|
||||||
|
|
||||||
|
#define SHIFT(state_value) \
|
||||||
|
{{ \
|
||||||
|
.shift = { \
|
||||||
|
.type = TSParseActionTypeShift, \
|
||||||
|
.state = (state_value) \
|
||||||
|
} \
|
||||||
|
}}
|
||||||
|
|
||||||
|
#define SHIFT_REPEAT(state_value) \
|
||||||
|
{{ \
|
||||||
|
.shift = { \
|
||||||
|
.type = TSParseActionTypeShift, \
|
||||||
|
.state = (state_value), \
|
||||||
|
.repetition = true \
|
||||||
|
} \
|
||||||
|
}}
|
||||||
|
|
||||||
|
#define SHIFT_EXTRA() \
|
||||||
|
{{ \
|
||||||
|
.shift = { \
|
||||||
|
.type = TSParseActionTypeShift, \
|
||||||
|
.extra = true \
|
||||||
|
} \
|
||||||
|
}}
|
||||||
|
|
||||||
|
#define REDUCE(symbol_name, children, precedence, prod_id) \
|
||||||
|
{{ \
|
||||||
|
.reduce = { \
|
||||||
|
.type = TSParseActionTypeReduce, \
|
||||||
|
.symbol = symbol_name, \
|
||||||
|
.child_count = children, \
|
||||||
|
.dynamic_precedence = precedence, \
|
||||||
|
.production_id = prod_id \
|
||||||
|
}, \
|
||||||
|
}}
|
||||||
|
|
||||||
|
#define RECOVER() \
|
||||||
|
{{ \
|
||||||
|
.type = TSParseActionTypeRecover \
|
||||||
|
}}
|
||||||
|
|
||||||
|
#define ACCEPT_INPUT() \
|
||||||
|
{{ \
|
||||||
|
.type = TSParseActionTypeAccept \
|
||||||
|
}}
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // TREE_SITTER_PARSER_H_
|
||||||
47
test/corpus/assert.txt
Normal file
47
test/corpus/assert.txt
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
=======================
|
||||||
|
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)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
57
test/corpus/auth.txt
Normal file
57
test/corpus/auth.txt
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
===========
|
||||||
|
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)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
192
test/corpus/body.txt
Normal file
192
test/corpus/body.txt
Normal file
@ -0,0 +1,192 @@
|
|||||||
|
==========
|
||||||
|
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)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
31
test/corpus/bruno.txt
Normal file
31
test/corpus/bruno.txt
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
================
|
||||||
|
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)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
239
test/corpus/methods.txt
Normal file
239
test/corpus/methods.txt
Normal file
@ -0,0 +1,239 @@
|
|||||||
|
=====================
|
||||||
|
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)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
197
test/corpus/real.txt
Normal file
197
test/corpus/real.txt
Normal file
@ -0,0 +1,197 @@
|
|||||||
|
=================
|
||||||
|
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)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
60
test/corpus/scripts.txt
Normal file
60
test/corpus/scripts.txt
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
========================
|
||||||
|
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)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
43
tree-sitter.json
Normal file
43
tree-sitter.json
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
"grammars": [
|
||||||
|
{
|
||||||
|
"name": "bruno",
|
||||||
|
"camelcase": "Bruno",
|
||||||
|
"scope": "source.bruno",
|
||||||
|
"path": ".",
|
||||||
|
"file-types": [
|
||||||
|
"bru"
|
||||||
|
],
|
||||||
|
"injection-regex": "^bruno$",
|
||||||
|
"highlights": [
|
||||||
|
"queries/highlights.scm"
|
||||||
|
],
|
||||||
|
"injections": [
|
||||||
|
"queries/injections.scm"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"version": "0.1.0",
|
||||||
|
"license": "MIT",
|
||||||
|
"description": " Bruno grammar for tree-sitter",
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Kristofers Solo",
|
||||||
|
"email": "dev@kristofers.xyz"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"links": {
|
||||||
|
"repository": "https://github.com/kristoferssolo/tree-sitter-bruno"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bindings": {
|
||||||
|
"c": true,
|
||||||
|
"go": true,
|
||||||
|
"node": true,
|
||||||
|
"python": true,
|
||||||
|
"rust": true,
|
||||||
|
"swift": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user