From ebb642cb144c77753ac7a9aefec34f03af7e3799 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 10 Apr 2024 15:30:57 +0000 Subject: [PATCH] Rename to 'tree-sitter-bp' This is really just to simplify my life and align with the Vim/NeoVim filetype name. --- .gitignore | 2 +- Cargo.toml | 4 ++-- README.md | 2 +- binding.gyp | 2 +- bindings/node/binding.cc | 8 ++++---- bindings/node/index.js | 4 ++-- bindings/rust/lib.rs | 10 +++++----- flake.nix | 6 +++--- grammar.js | 2 +- package.json | 4 ++-- src/grammar.json | 2 +- src/parser.c | 2 +- 12 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.gitignore b/.gitignore index 244f59a..f565f65 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,6 @@ /.pre-commit-config.yaml # Tree-sitter artifact -/tree-sitter-blueprint.wasm +/tree-sitter-bp.wasm # Rust bindings /target diff --git a/Cargo.toml b/Cargo.toml index 9e95645..28da48a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "tree-sitter-blueprint" +name = "tree-sitter-bp" description = "Blueprint grammar for the tree-sitter parsing library" version = "0.1.0" keywords = ["incremental", "parsing", "android", "blueprint"] categories = ["parsing", "text-editors"] -repository = "https://git.belanyi.fr/ambroisie/tree-sitter-blueprint" +repository = "https://git.belanyi.fr/ambroisie/tree-sitter-bp" edition = "2018" license = "MIT" diff --git a/README.md b/README.md index 0a33789..129e93d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# tree-sitter-blueprint +# tree-sitter-bp Tree-sitter grammar for [Blueprint][blueprint-aosp], the meta-build system used in AOSP for its `Android.bp` files. diff --git a/binding.gyp b/binding.gyp index c94ea72..be4507b 100644 --- a/binding.gyp +++ b/binding.gyp @@ -1,7 +1,7 @@ { "targets": [ { - "target_name": "tree_sitter_blueprint_binding", + "target_name": "tree_sitter_bp_binding", "include_dirs": [ " exports, Local module) { Local constructor = Nan::GetFunction(tpl).ToLocalChecked(); Local instance = constructor->NewInstance(Nan::GetCurrentContext()).ToLocalChecked(); - Nan::SetInternalFieldPointer(instance, 0, tree_sitter_blueprint()); + Nan::SetInternalFieldPointer(instance, 0, tree_sitter_bp()); - Nan::Set(instance, Nan::New("name").ToLocalChecked(), Nan::New("blueprint").ToLocalChecked()); + Nan::Set(instance, Nan::New("name").ToLocalChecked(), Nan::New("bp").ToLocalChecked()); Nan::Set(module, Nan::New("exports").ToLocalChecked(), instance); } -NODE_MODULE(tree_sitter_blueprint_binding, Init) +NODE_MODULE(tree_sitter_bp_binding, Init) } // namespace diff --git a/bindings/node/index.js b/bindings/node/index.js index 3b30fe6..9bd9a6e 100644 --- a/bindings/node/index.js +++ b/bindings/node/index.js @@ -1,11 +1,11 @@ try { - module.exports = require("../../build/Release/tree_sitter_blueprint_binding"); + module.exports = require("../../build/Release/tree_sitter_bp_binding"); } catch (error1) { if (error1.code !== 'MODULE_NOT_FOUND') { throw error1; } try { - module.exports = require("../../build/Debug/tree_sitter_blueprint_binding"); + module.exports = require("../../build/Debug/tree_sitter_bp_binding"); } catch (error2) { if (error2.code !== 'MODULE_NOT_FOUND') { throw error2; diff --git a/bindings/rust/lib.rs b/bindings/rust/lib.rs index 5f3b8ca..22bfdfc 100644 --- a/bindings/rust/lib.rs +++ b/bindings/rust/lib.rs @@ -1,4 +1,4 @@ -//! This crate provides blueprint support for the [tree-sitter][] parsing library. +//! This crate provides bp support for the [tree-sitter][] parsing library. //! //! Typically, you will use the [language][language func] function to add this language to a //! tree-sitter [Parser][], and then use the parser to parse some code: @@ -6,7 +6,7 @@ //! ``` //! let code = ""; //! let mut parser = tree_sitter::Parser::new(); -//! parser.set_language(tree_sitter_blueprint::language()).expect("Error loading txtpb grammar"); +//! parser.set_language(tree_sitter_bp::language()).expect("Error loading txtpb grammar"); //! let tree = parser.parse(code, None).unwrap(); //! ``` //! @@ -18,14 +18,14 @@ use tree_sitter::Language; extern "C" { - fn tree_sitter_blueprint() -> Language; + fn tree_sitter_bp() -> Language; } /// Get the tree-sitter [Language][] for this grammar. /// /// [Language]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Language.html pub fn language() -> Language { - unsafe { tree_sitter_blueprint() } + unsafe { tree_sitter_bp() } } /// The content of the [`node-types.json`][] file for this grammar. @@ -47,6 +47,6 @@ mod tests { let mut parser = tree_sitter::Parser::new(); parser .set_language(super::language()) - .expect("Error loading blueprint language"); + .expect("Error loading bp language"); } } diff --git a/flake.nix b/flake.nix index e7053c4..2ac4027 100644 --- a/flake.nix +++ b/flake.nix @@ -122,9 +122,9 @@ }; packages = { - default = packages.tree-sitter-blueprint; + default = packages.tree-sitter-bp; - inherit (pkgs.tree-sitter.passthru.builtGrammars) tree-sitter-blueprint; + inherit (pkgs.tree-sitter.passthru.builtGrammars) tree-sitter-bp; inherit (pkgs) tree-sitter; }; @@ -133,7 +133,7 @@ default = final: prev: { tree-sitter = prev.tree-sitter.override { extraGrammars = { - tree-sitter-blueprint = { + tree-sitter-bp = { src = ./.; }; }; diff --git a/grammar.js b/grammar.js index 929f36e..a22f3d7 100644 --- a/grammar.js +++ b/grammar.js @@ -7,7 +7,7 @@ function trailingCommaSeparated(elem) { } module.exports = grammar({ - name: "blueprint", + name: "bp", extras: ($) => [ /\s+/, diff --git a/package.json b/package.json index 3db073a..5b2c53d 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "tree-sitter-blueprint", + "name": "tree-sitter-bp", "version": "0.1.0", "description": "Blueprint grammar for tree-sitter", "main": "bindings/node", @@ -18,7 +18,7 @@ }, "tree-sitter": [ { - "scope": "source.blueprint", + "scope": "source.bp", "file-types": [ "bp" ], diff --git a/src/grammar.json b/src/grammar.json index 2ac5436..84c6bce 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -1,5 +1,5 @@ { - "name": "blueprint", + "name": "bp", "rules": { "source_file": { "type": "REPEAT", diff --git a/src/parser.c b/src/parser.c index f7c2b6f..5171d84 100644 --- a/src/parser.c +++ b/src/parser.c @@ -7926,7 +7926,7 @@ extern "C" { #define extern __declspec(dllexport) #endif -extern const TSLanguage *tree_sitter_blueprint(void) { +extern const TSLanguage *tree_sitter_bp(void) { static const TSLanguage language = { .version = LANGUAGE_VERSION, .symbol_count = SYMBOL_COUNT,