Rename to 'tree-sitter-bp'
All checks were successful
ci/woodpecker/push/check Pipeline was successful

This is really just to simplify my life and align with the Vim/NeoVim
filetype name.
This commit is contained in:
Bruno BELANYI 2024-04-10 15:30:57 +00:00
parent f6e1266493
commit ebb642cb14
12 changed files with 24 additions and 24 deletions

2
.gitignore vendored
View file

@ -3,6 +3,6 @@
/.pre-commit-config.yaml /.pre-commit-config.yaml
# Tree-sitter artifact # Tree-sitter artifact
/tree-sitter-blueprint.wasm /tree-sitter-bp.wasm
# Rust bindings # Rust bindings
/target /target

View file

@ -1,10 +1,10 @@
[package] [package]
name = "tree-sitter-blueprint" name = "tree-sitter-bp"
description = "Blueprint grammar for the tree-sitter parsing library" description = "Blueprint grammar for the tree-sitter parsing library"
version = "0.1.0" version = "0.1.0"
keywords = ["incremental", "parsing", "android", "blueprint"] keywords = ["incremental", "parsing", "android", "blueprint"]
categories = ["parsing", "text-editors"] categories = ["parsing", "text-editors"]
repository = "https://git.belanyi.fr/ambroisie/tree-sitter-blueprint" repository = "https://git.belanyi.fr/ambroisie/tree-sitter-bp"
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"

View file

@ -1,4 +1,4 @@
# tree-sitter-blueprint # tree-sitter-bp
Tree-sitter grammar for [Blueprint][blueprint-aosp], the meta-build system used Tree-sitter grammar for [Blueprint][blueprint-aosp], the meta-build system used
in AOSP for its `Android.bp` files. in AOSP for its `Android.bp` files.

View file

@ -1,7 +1,7 @@
{ {
"targets": [ "targets": [
{ {
"target_name": "tree_sitter_blueprint_binding", "target_name": "tree_sitter_bp_binding",
"include_dirs": [ "include_dirs": [
"<!(node -e \"require('nan')\")", "<!(node -e \"require('nan')\")",
"src" "src"

View file

@ -4,7 +4,7 @@
using namespace v8; using namespace v8;
extern "C" TSLanguage * tree_sitter_blueprint(); extern "C" TSLanguage * tree_sitter_bp();
namespace { namespace {
@ -17,12 +17,12 @@ void Init(Local<Object> exports, Local<Object> module) {
Local<Function> constructor = Nan::GetFunction(tpl).ToLocalChecked(); Local<Function> constructor = Nan::GetFunction(tpl).ToLocalChecked();
Local<Object> instance = constructor->NewInstance(Nan::GetCurrentContext()).ToLocalChecked(); Local<Object> 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); Nan::Set(module, Nan::New("exports").ToLocalChecked(), instance);
} }
NODE_MODULE(tree_sitter_blueprint_binding, Init) NODE_MODULE(tree_sitter_bp_binding, Init)
} // namespace } // namespace

View file

@ -1,11 +1,11 @@
try { try {
module.exports = require("../../build/Release/tree_sitter_blueprint_binding"); module.exports = require("../../build/Release/tree_sitter_bp_binding");
} catch (error1) { } catch (error1) {
if (error1.code !== 'MODULE_NOT_FOUND') { if (error1.code !== 'MODULE_NOT_FOUND') {
throw error1; throw error1;
} }
try { try {
module.exports = require("../../build/Debug/tree_sitter_blueprint_binding"); module.exports = require("../../build/Debug/tree_sitter_bp_binding");
} catch (error2) { } catch (error2) {
if (error2.code !== 'MODULE_NOT_FOUND') { if (error2.code !== 'MODULE_NOT_FOUND') {
throw error2; throw error2;

View file

@ -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 //! 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: //! tree-sitter [Parser][], and then use the parser to parse some code:
@ -6,7 +6,7 @@
//! ``` //! ```
//! let code = ""; //! let code = "";
//! let mut parser = tree_sitter::Parser::new(); //! 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(); //! let tree = parser.parse(code, None).unwrap();
//! ``` //! ```
//! //!
@ -18,14 +18,14 @@
use tree_sitter::Language; use tree_sitter::Language;
extern "C" { extern "C" {
fn tree_sitter_blueprint() -> Language; fn tree_sitter_bp() -> Language;
} }
/// Get the tree-sitter [Language][] for this grammar. /// Get the tree-sitter [Language][] for this grammar.
/// ///
/// [Language]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Language.html /// [Language]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Language.html
pub fn language() -> Language { pub fn language() -> Language {
unsafe { tree_sitter_blueprint() } unsafe { tree_sitter_bp() }
} }
/// The content of the [`node-types.json`][] file for this grammar. /// The content of the [`node-types.json`][] file for this grammar.
@ -47,6 +47,6 @@ mod tests {
let mut parser = tree_sitter::Parser::new(); let mut parser = tree_sitter::Parser::new();
parser parser
.set_language(super::language()) .set_language(super::language())
.expect("Error loading blueprint language"); .expect("Error loading bp language");
} }
} }

View file

@ -122,9 +122,9 @@
}; };
packages = { 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; inherit (pkgs) tree-sitter;
}; };
@ -133,7 +133,7 @@
default = final: prev: { default = final: prev: {
tree-sitter = prev.tree-sitter.override { tree-sitter = prev.tree-sitter.override {
extraGrammars = { extraGrammars = {
tree-sitter-blueprint = { tree-sitter-bp = {
src = ./.; src = ./.;
}; };
}; };

View file

@ -7,7 +7,7 @@ function trailingCommaSeparated(elem) {
} }
module.exports = grammar({ module.exports = grammar({
name: "blueprint", name: "bp",
extras: ($) => [ extras: ($) => [
/\s+/, /\s+/,

View file

@ -1,5 +1,5 @@
{ {
"name": "tree-sitter-blueprint", "name": "tree-sitter-bp",
"version": "0.1.0", "version": "0.1.0",
"description": "Blueprint grammar for tree-sitter", "description": "Blueprint grammar for tree-sitter",
"main": "bindings/node", "main": "bindings/node",
@ -18,7 +18,7 @@
}, },
"tree-sitter": [ "tree-sitter": [
{ {
"scope": "source.blueprint", "scope": "source.bp",
"file-types": [ "file-types": [
"bp" "bp"
], ],

2
src/grammar.json generated
View file

@ -1,5 +1,5 @@
{ {
"name": "blueprint", "name": "bp",
"rules": { "rules": {
"source_file": { "source_file": {
"type": "REPEAT", "type": "REPEAT",

2
src/parser.c generated
View file

@ -7926,7 +7926,7 @@ extern "C" {
#define extern __declspec(dllexport) #define extern __declspec(dllexport)
#endif #endif
extern const TSLanguage *tree_sitter_blueprint(void) { extern const TSLanguage *tree_sitter_bp(void) {
static const TSLanguage language = { static const TSLanguage language = {
.version = LANGUAGE_VERSION, .version = LANGUAGE_VERSION,
.symbol_count = SYMBOL_COUNT, .symbol_count = SYMBOL_COUNT,