Skip to main content

tree-sitter-hbk

CI npm crates.io PyPI

Грамматика 1C BSL в формате tree-sitter. Пакет также содержит отдельную грамматику sdbl для языка запросов 1C.

Попробовать

playground

Что входит

  • bsl: грамматика исходных файлов BSL (.bsl, .osl).
  • sdbl: грамматика самостоятельных текстов запросов 1C (.sdbl).
  • Query-файлы tree-sitter для подсветки BSL/SDBL и внедрения статических строковых литералов BSL, начинающихся с ВЫБРАТЬ, SELECT, УНИЧТОЖИТЬ или DROP, как sdbl.
  • Локальное dev-расширение Zed в editors/zed-bsl для проверки подсветки BSL, самостоятельного SDBL и внедренного SDBL.

BSL и SDBL остаются разными контрактами парсера. Грамматика BSL не встраивает SDBL в AST строковых литералов; разбор встроенных запросов выполняется через tree-sitter injections и композицию на стороне редактора.

Локальная разработка

Локальный tree-sitter playground запускается отдельно для каждой грамматики:

npm start
npm run start:bsl
npm run start:sdbl

npm start является псевдонимом для BSL playground. npm run start:sdbl запускает playground самостоятельной грамматики SDBL. При необходимости можно собрать оба WASM-парсера:

npm run build:wasm

Быстрая проверка дерева разбора:

npm run parse:bsl -- examples/playground/basic.bsl
npm run parse:sdbl -- examples/playground/select.sdbl

Небольшие примеры для playground лежат в examples/playground:

  • basic.bsl для синтаксиса исходных файлов BSL;
  • select.sdbl и query-package.sdbl для синтаксиса самостоятельных SDBL-запросов.

SDBL-примеры разбираются самостоятельной грамматикой SDBL. BSL-строки с текстом запроса остаются узлами строк BSL; разбор встроенного запроса относится к отдельному контракту injection/composition.

Основные команды проверки:

npm run test:corpus
npm test
npm run test:all

npm run test:corpus использует локальный для пакета tree-sitter-cli и проверяет оба набора corpus-тестов. Для системного tree-sitter CLI, который поддерживает -p, эквивалентные команды:

tree-sitter test -p grammars/bsl
tree-sitter test -p grammars/sdbl

Использование

Rust

Добавьте зависимость в Cargo.toml:

[dependencies]
tree-sitter = "0.25"
tree-sitter-hbk = "0.1"
use tree_sitter::Parser;

fn main() {
    let mut parser = Parser::new();
    parser
        .set_language(&tree_sitter_hbk::LANGUAGE.into())
        .expect("Error loading BSL grammar");

    let source = r#"
        Процедура Привет()
            Сообщить("Привет, мир!");
        КонецПроцедуры
    "#;

    let tree = parser.parse(source, None).unwrap();
    println!("{}", tree.root_node().to_sexp());
}

Node.js

Установите пакет:

npm install tree-sitter-hbk tree-sitter
const Parser = require("tree-sitter");
const BSL = require("tree-sitter-hbk");

const parser = new Parser();
parser.setLanguage(BSL);

const sourceCode = `
Процедура Привет()
    Сообщить("Привет, мир!");
КонецПроцедуры
`;

const tree = parser.parse(sourceCode);
console.log(tree.rootNode.toString());

Python

Установите пакет:

pip install tree-sitter-hbk tree-sitter
import tree_sitter_hbk as tshbk
from tree_sitter import Language, Parser

BSL_LANGUAGE = Language(tshbk.language())
parser = Parser(BSL_LANGUAGE)

source = """
Процедура Привет()
    Сообщить("Привет, мир!");
КонецПроцедуры
""".encode()

tree = parser.parse(source)
print(tree.root_node.sexp())

Грамматика запросов SDBL

Пакет также экспортирует самостоятельную грамматику языка запросов SDBL:

  • Node.js: require("tree-sitter-hbk").sdbl;
  • Rust: tree_sitter_hbk::SDBL_LANGUAGE;
  • Python: tree_sitter_hbk.SDBLLanguage() или низкоуровневая капсула tree_sitter_hbk.sdbl_language();
  • Go: tree_sitter_bsl.SDBLLanguage() from the existing Go binding package;
  • C: tree_sitter_sdbl() из tree-sitter-bsl.h и той же библиотеки.

Существующие точки входа BSL остаются языком пакета по умолчанию.

Пакет включает query-файлы tree-sitter для интеграций с редакторами:

  • grammars/bsl/queries/highlights.scm для подсветки BSL;
  • grammars/bsl/queries/injections.scm для внедрения статических строковых литералов BSL, начинающихся с ключевых слов SDBL-выражений, как sdbl;
  • grammars/sdbl/queries/highlights.scm для подсветки самостоятельного SDBL и текста запросов, внедренного из BSL.

Для Zed используется локальное dev extension: editors/zed-bsl. Оно регистрирует BSL, SDBL и специальную для Zed грамматику-носитель sdbl_embedded, чтобы исходный текст внедренной BSL-строки подсвечивался без изменения контракта самостоятельной грамматики .sdbl.

Ссылки

Metadata

Release files for tree-sitter-hbk 0.1.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tree-sitter-hbk 0.1.11
File Size Uploaded Provenance
tree_sitter_hbk-0.1.11.tar.gz 177.6 kB With provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for tree-sitter-hbk 0.1.11
File
tree_sitter_hbk-0.1.11-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
tree_sitter_hbk-0.1.11-cp310-abi3-win32.whl CPython 3.10 abi3 Windows x86-32 Details
tree_sitter_hbk-0.1.11-cp310-abi3-musllinux_1_2_x86_64.whl CPython 3.10 abi3 Linux musl 1.2+ x86-64 Details
tree_sitter_hbk-0.1.11-cp310-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl CPython 3.10 abi3 Linux glibc 2.5+ x86-64, Linux glibc 2.28+ x86-64 Details
tree_sitter_hbk-0.1.11-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details

Total release size: 691.6 kB

Release files / tree_sitter_hbk-0.1.11.tar.gz

Download URL tree_sitter_hbk-0.1.11.tar.gz
Size 177.6 kB
Tags Source
SHA-256 checksum
How to use checksums
0df19bcba100e01e8052b554bc0d3555413cedcfc4b3991b70e686735153be1d
BLAKE2b-256 checksum
How to use checksums
ec14de41eff2e963ef94024e14b89c3366a611ad4ca5fe3e84fe954c3a518645
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 23, 2026.

Transparency log

Release files / tree_sitter_hbk-0.1.11-cp310-abi3-win_amd64.whl

Download URL tree_sitter_hbk-0.1.11-cp310-abi3-win_amd64.whl
Size 96.7 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
0d63affb48ea1f0a69d5b993a52446aadac9e3d377a806182223663b6565695b
BLAKE2b-256 checksum
How to use checksums
9dc36a2784230287fbf9866874f612ef4b3331d2db9a16ee21cdfa523af1be91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 23, 2026.

Transparency log

Release files / tree_sitter_hbk-0.1.11-cp310-abi3-win32.whl

Download URL tree_sitter_hbk-0.1.11-cp310-abi3-win32.whl
Size 99.8 kB
Tags CPython 3.10 Windows x86-32 abi3
SHA-256 checksum
How to use checksums
69f9f646f2a9cc6b57d4f81fc394e044c578fe470f81bf29efeb10bbae97daeb
BLAKE2b-256 checksum
How to use checksums
0ee41aa47d80623e8561687d259012d490a174859654507e2965657df1223afe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 23, 2026.

Transparency log

Release files / tree_sitter_hbk-0.1.11-cp310-abi3-musllinux_1_2_x86_64.whl

Download URL tree_sitter_hbk-0.1.11-cp310-abi3-musllinux_1_2_x86_64.whl
Size 109.7 kB
Tags CPython 3.10 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
d52a27ac4cf18bd35fcda64f8beda62487b796960ef9ab597b4bfeadeef8398c
BLAKE2b-256 checksum
How to use checksums
624f34cd5eaad1de92e94088a44efb5e85951cb1e8126575b39365997a10cd27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 23, 2026.

Transparency log

Release files / tree_sitter_hbk-0.1.11-cp310-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl

Download URL tree_sitter_hbk-0.1.11-cp310-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Size 109.9 kB
Tags CPython 3.10 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 abi3
SHA-256 checksum
How to use checksums
292e3d00b8d24268416be2f76b4b6d4c6c5cab723606166f67e772c98f24e561
BLAKE2b-256 checksum
How to use checksums
625ab8e402ca3ab542d8cd9d3530eb542e316a3cfccd84867f542ebc8c65d6e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 23, 2026.

Transparency log

Release files / tree_sitter_hbk-0.1.11-cp310-abi3-macosx_11_0_arm64.whl

Download URL tree_sitter_hbk-0.1.11-cp310-abi3-macosx_11_0_arm64.whl
Size 98.0 kB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
85a67ef160bedfbbe49698b7b01cd433f9172d4ee0f075988b359058f7285b29
BLAKE2b-256 checksum
How to use checksums
7926376e8427acd967a4e14a427c6332712e032895b55104ccbf51a5e3b8e6e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 23, 2026.

Transparency log

Security for tree-sitter-hbk 0.1.11

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for tree_sitter_hbk-0.1.11.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page