diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 07fefda..40f0c08 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -50,3 +50,19 @@ jobs: run: ./scripts/rust_playground_crate.sh publish env: CARGO_REGISTRY_TOKEN: ${{secrets.CARGO_REGISTRY_TOKEN}} + + crates_routine: + name: Publish Rust routine package + runs-on: ubuntu-latest + environment: + name: crates + url: https://crates.io/crates/tree-sitter-objectscript-routine + steps: + - name: Checkout repository + uses: actions/checkout@v6 + - name: Set up Rust + uses: actions-rust-lang/setup-rust-toolchain@v1 + - name: Publish to crates.io + run: ./scripts/rust_routine_crate.sh publish + env: + CARGO_REGISTRY_TOKEN: ${{secrets.CARGO_REGISTRY_TOKEN}} diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d76299..39abc5d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.13) project(tree-sitter-objectscript - VERSION "1.7.0" + VERSION "1.7.1" DESCRIPTION "ObjectScript grammar for tree-sitter" HOMEPAGE_URL "https://github.com/intersystems/tree-sitter-objectscript" LANGUAGES C) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a3ec842..234fa11 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -95,10 +95,11 @@ make query Run from repository root. -- Rust (UDL + routine crate): +- Rust (UDL crate + staged routine/playground crates): ```bash cargo test --lib --package tree-sitter-objectscript +./scripts/rust_routine_crate.sh package --allow-dirty --no-verify ./scripts/rust_playground_crate.sh package --allow-dirty --no-verify ``` diff --git a/Cargo.toml b/Cargo.toml index 94cdff9..9eda537 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "tree-sitter-objectscript" description = "ObjectScript UDL grammar for tree-sitter" -version = "1.7.0" +version = "1.7.1" keywords = ["incremental", "parsing", "objectscript", "udl"] categories = ["parsing", "text-editors"] repository = "https://github.com/intersystems/tree-sitter-objectscript" @@ -25,13 +25,6 @@ include = [ "/udl/queries/highlights.scm", "/udl/queries/indents.scm", "/udl/queries/injections.scm", - "/objectscript_routine/src/parser.c", - "/objectscript_routine/src/scanner.c", - "/objectscript_routine/src/node-types.json", - "/objectscript_routine/src/tree_sitter/parser.h", - "/objectscript_routine/queries/highlights.scm", - "/objectscript_routine/queries/indents.scm", - "/objectscript_routine/queries/injections.scm", ] readme = "cargo_readme.md" diff --git a/README.md b/README.md index 1ad7aef..d544493 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ [![CI][ci]](https://github.com/intersystems/tree-sitter-objectscript/actions/workflows/ci.yml) [![npm][npm]](https://www.npmjs.com/package/tree-sitter-objectscript) [![crates-udl][crates-udl]](https://crates.io/crates/tree-sitter-objectscript) +[![crates-routine][crates-routine]](https://crates.io/crates/tree-sitter-objectscript-routine) [![crates-playground][crates-playground]](https://crates.io/crates/tree-sitter-objectscript-playground) [![pypi][pypi]](https://pypi.org/project/tree-sitter-objectscript/) @@ -27,7 +28,8 @@ Grammar extension graph: - npm: `tree-sitter-objectscript` - PyPI: `tree-sitter-objectscript` (ships `tree_sitter_objectscript`, `tree_sitter_objectscript_udl`, and `tree_sitter_objectscript_routine`) - Rust crates: - - `tree-sitter-objectscript` (UDL + routine grammars) + - `tree-sitter-objectscript` (UDL grammar) + - `tree-sitter-objectscript-routine` (routine grammar) - `tree-sitter-objectscript-playground` (playground grammar) ## Bindings @@ -38,7 +40,7 @@ Language bindings are available under `bindings/`: - Go: `bindings/go` - Node.js: `bindings/node` - Python: `bindings/python` -- Rust: `bindings/rust` and `bindings/rust-playground` +- Rust: `bindings/rust`, `bindings/rust-routine`, and `bindings/rust-playground` - Swift: `bindings/swift` Quick binding checks from repo root: @@ -127,5 +129,6 @@ MIT. See [LICENSE](LICENSE). [ci]: https://img.shields.io/github/actions/workflow/status/intersystems/tree-sitter-objectscript/ci.yml?logo=github&label=CI [npm]: https://img.shields.io/npm/v/tree-sitter-objectscript?logo=npm [crates-udl]: https://img.shields.io/crates/v/tree-sitter-objectscript?logo=rust +[crates-routine]: https://img.shields.io/crates/v/tree-sitter-objectscript-routine?logo=rust [crates-playground]: https://img.shields.io/crates/v/tree-sitter-objectscript-playground?logo=rust [pypi]: https://img.shields.io/pypi/v/tree-sitter-objectscript?logo=pypi&logoColor=ffd242 diff --git a/bindings/rust-playground/Cargo.toml b/bindings/rust-playground/Cargo.toml index d10229d..645553e 100644 --- a/bindings/rust-playground/Cargo.toml +++ b/bindings/rust-playground/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "tree-sitter-objectscript-playground" description = "ObjectScript playground grammar for tree-sitter" -version = "1.7.0" +version = "1.7.1" keywords = ["incremental", "parsing", "objectscript"] categories = ["parsing", "text-editors"] repository = "https://github.com/intersystems/tree-sitter-objectscript" diff --git a/bindings/rust-routine/Cargo.toml b/bindings/rust-routine/Cargo.toml new file mode 100644 index 0000000..30bc5ba --- /dev/null +++ b/bindings/rust-routine/Cargo.toml @@ -0,0 +1,39 @@ +[package] +name = "tree-sitter-objectscript-routine" +description = "ObjectScript routine grammar for tree-sitter" +version = "1.7.1" +keywords = ["incremental", "parsing", "objectscript"] +categories = ["parsing", "text-editors"] +repository = "https://github.com/intersystems/tree-sitter-objectscript" +edition = "2021" +license = "MIT" +authors = [ + "Dave McCaldon ", + "Hannah Kimura ", +] +build = "build.rs" +include = [ + "/LICENSE", + "/cargo_readme_routine.md", + "/build.rs", + "/lib.rs", + "/common/scanner.h", + "/objectscript_routine/src/parser.c", + "/objectscript_routine/src/scanner.c", + "/objectscript_routine/src/node-types.json", + "/objectscript_routine/src/tree_sitter/parser.h", + "/objectscript_routine/queries/highlights.scm", + "/objectscript_routine/queries/indents.scm", + "/objectscript_routine/queries/injections.scm", +] +readme = "cargo_readme_routine.md" + +[lib] +path = "lib.rs" + +[dependencies] +tree-sitter = ">=0.26.6" +tree-sitter-language = "0.1" + +[build-dependencies] +cc = "1.0" diff --git a/bindings/rust-routine/build.rs b/bindings/rust-routine/build.rs new file mode 100644 index 0000000..fd5163a --- /dev/null +++ b/bindings/rust-routine/build.rs @@ -0,0 +1,30 @@ +use std::path::Path; + +fn main() { + let root_dir = Path::new("."); + let routine_dir = root_dir.join("objectscript_routine").join("src"); + let common_dir = root_dir.join("common"); + let mut config = cc::Build::new(); + + config.include(&routine_dir); + + for path in &[ + routine_dir.join("parser.c"), + routine_dir.join("scanner.c"), + ] { + config.file(path); + println!("cargo:rerun-if-changed={}", path.to_str().unwrap()); + } + + println!( + "cargo:rerun-if-changed={}", + common_dir.join("scanner.h").to_str().unwrap() + ); + + // MSVC quirk + if cfg!(target_env = "msvc") { + config.define("TREE_SITTER_DISABLE_ATOMIC", None); + } + + config.compile("tree-sitter-objectscript-routine"); +} diff --git a/bindings/rust-routine/lib.rs b/bindings/rust-routine/lib.rs new file mode 100644 index 0000000..55d8151 --- /dev/null +++ b/bindings/rust-routine/lib.rs @@ -0,0 +1,54 @@ +//! This crate provides ObjectScript routine language support for the [tree-sitter][] parsing library. +//! +//! [tree-sitter]: https://tree-sitter.github.io/ + +use tree_sitter_language::LanguageFn; + +extern "C" { + fn tree_sitter_objectscript_routine() -> *const (); +} + +/// The tree-sitter [`LanguageFn`] for ObjectScript routine grammar. +/// +/// [LanguageFn]: https://docs.rs/tree-sitter-language/*/tree_sitter_language/struct.LanguageFn.html +pub const LANGUAGE_OBJECTSCRIPT_ROUTINE: LanguageFn = unsafe { LanguageFn::from_raw(tree_sitter_objectscript_routine) }; + +/// The content of the [`node-types.json`][] file for ObjectScript routine grammar. +/// +/// [`node-types.json`]: https://tree-sitter.github.io/tree-sitter/using-parsers#static-node-types +pub const NODE_TYPES: &str = include_str!("objectscript_routine/src/node-types.json"); + +/// The syntax highlighting query for ObjectScript routine grammar. +pub const HIGHLIGHTS_QUERY: &str = include_str!("objectscript_routine/queries/highlights.scm"); + +/// The injections query for ObjectScript routine grammar. +pub const INJECTIONS_QUERY: &str = include_str!("objectscript_routine/queries/injections.scm"); + +/// The indents query for ObjectScript routine grammar. +pub const INDENTS_QUERY: &str = include_str!("objectscript_routine/queries/indents.scm"); + +#[cfg(test)] +mod tests { + #[test] + fn test_can_load_objectscript_routine_grammar() { + let mut parser = tree_sitter::Parser::new(); + parser + .set_language(&super::LANGUAGE_OBJECTSCRIPT_ROUTINE.into()) + .expect("Error loading ObjectScript routine parser"); + } + + #[test] + fn test_indents_query_is_loaded() { + assert!(super::INDENTS_QUERY.contains("indent")); + } + + #[test] + fn test_injections_query_is_loaded() { + assert!(super::INJECTIONS_QUERY.contains("injection")); + } + + #[test] + fn test_highlights_query_is_loaded() { + assert!(super::HIGHLIGHTS_QUERY.contains("@keyword")); + } +} diff --git a/bindings/rust/build.rs b/bindings/rust/build.rs index 46407bd..decb9af 100644 --- a/bindings/rust/build.rs +++ b/bindings/rust/build.rs @@ -2,14 +2,13 @@ use std::path::Path; fn main() { let root_dir = Path::new("."); - let obj_udl_dir = root_dir.join("udl").join("src"); - let routine_dir = root_dir.join("objectscript_routine").join("src"); + let udl_dir = root_dir.join("udl").join("src"); let common_dir = root_dir.join("common"); let mut config = cc::Build::new(); - config.include(&obj_udl_dir); + config.include(&udl_dir); - for path in &[obj_udl_dir.join("parser.c"), obj_udl_dir.join("scanner.c"), routine_dir.join("parser.c"), routine_dir.join("scanner.c")] { + for path in &[udl_dir.join("parser.c"), udl_dir.join("scanner.c")] { config.file(path); println!("cargo:rerun-if-changed={}", path.to_str().unwrap()); } diff --git a/bindings/rust/lib.rs b/bindings/rust/lib.rs index 2948c1b..462d59d 100644 --- a/bindings/rust/lib.rs +++ b/bindings/rust/lib.rs @@ -1,4 +1,4 @@ -//! This crate provides ObjectScript Class and Routine language support for the [tree-sitter][] parsing library. +//! This crate provides ObjectScript UDL language support for the [tree-sitter][] parsing library. //! //! [tree-sitter]: https://tree-sitter.github.io/ @@ -6,7 +6,6 @@ use tree_sitter_language::LanguageFn; extern "C" { fn tree_sitter_objectscript_udl() -> *const (); - fn tree_sitter_objectscript_routine() -> *const (); } /// The tree-sitter [`LanguageFn`] for ObjectScript UDL grammar. @@ -17,35 +16,16 @@ pub const LANGUAGE_OBJECTSCRIPT_UDL: LanguageFn = unsafe { LanguageFn::from_raw( /// The content of the [`node-types.json`][] file for ObjectScript UDL grammar. /// /// [`node-types.json`]: https://tree-sitter.github.io/tree-sitter/using-parsers#static-node-types -pub const UDL_NODE_TYPES: &str = include_str!("../../udl/src/node-types.json"); +pub const NODE_TYPES: &str = include_str!("../../udl/src/node-types.json"); /// The syntax highlighting query for ObjectScript UDL. -pub const UDL_HIGHLIGHTS_QUERY: &str = include_str!("../../udl/queries/highlights.scm"); +pub const HIGHLIGHTS_QUERY: &str = include_str!("../../udl/queries/highlights.scm"); /// The injections query for ObjectScript UDL. -pub const UDL_INJECTIONS_QUERY: &str = include_str!("../../udl/queries/injections.scm"); +pub const INJECTIONS_QUERY: &str = include_str!("../../udl/queries/injections.scm"); /// The indents query for ObjectScript UDL. -pub const UDL_INDENTS_QUERY: &str = include_str!("../../udl/queries/indents.scm"); - -/// The tree-sitter [`LanguageFn`] for ObjectScript Routine grammar. -/// -/// [LanguageFn]: https://docs.rs/tree-sitter-language/*/tree_sitter_language/struct.LanguageFn.html -pub const LANGUAGE_OBJECTSCRIPT_ROUTINE: LanguageFn = unsafe { LanguageFn::from_raw(tree_sitter_objectscript_routine) }; - -/// The content of the [`node-types.json`][] file for ObjectScript Routine grammar. -/// -/// [`node-types.json`]: https://tree-sitter.github.io/tree-sitter/using-parsers#static-node-types -pub const ROUTINE_NODE_TYPES: &str = include_str!("../../objectscript_routine/src/node-types.json"); - -/// The syntax highlighting query for ObjectScript Routines. -pub const ROUTINE_HIGHLIGHTS_QUERY: &str = include_str!("../../objectscript_routine/queries/highlights.scm"); - -/// The injections query for ObjectScript Routines. -pub const ROUTINE_INJECTIONS_QUERY: &str = include_str!("../../objectscript_routine/queries/injections.scm"); - -/// The indents query for ObjectScript Routines. -pub const ROUTINE_INDENTS_QUERY: &str = include_str!("../../objectscript_routine/queries/indents.scm"); +pub const INDENTS_QUERY: &str = include_str!("../../udl/queries/indents.scm"); #[cfg(test)] mod tests { @@ -57,43 +37,18 @@ mod tests { .expect("Error loading ObjectScript UDL parser"); } - #[test] - fn test_iudl_ndents_query_is_loaded() { - assert!(super::UDL_INDENTS_QUERY.contains("indent")); + fn test_udl_indents_query_is_loaded() { + assert!(super::INDENTS_QUERY.contains("indent")); } #[test] fn test_udl_injections_query_is_loaded() { - assert!(super::UDL_INJECTIONS_QUERY.contains("injection")); + assert!(super::INJECTIONS_QUERY.contains("injection")); } #[test] fn test_udl_highlights_query_is_loaded() { - assert!(super::UDL_HIGHLIGHTS_QUERY.contains("@keyword")); - } - - #[test] - fn test_can_load_objectscript_routine_grammar() { - let mut parser = tree_sitter::Parser::new(); - parser - .set_language(&super::LANGUAGE_OBJECTSCRIPT_ROUTINE.into()) - .expect("Error loading ObjectScript UDL parser"); - } - - - #[test] - fn test_routine_indents_query_is_loaded() { - assert!(super::ROUTINE_INDENTS_QUERY.contains("indent")); - } - - #[test] - fn test_routine_injections_query_is_loaded() { - assert!(super::ROUTINE_INJECTIONS_QUERY.contains("injection")); - } - - #[test] - fn test_routine_highlights_query_is_loaded() { - assert!(super::ROUTINE_HIGHLIGHTS_QUERY.contains("@keyword")); + assert!(super::HIGHLIGHTS_QUERY.contains("@keyword")); } } diff --git a/cargo_readme.md b/cargo_readme.md index 09bddc9..b83d5f5 100644 --- a/cargo_readme.md +++ b/cargo_readme.md @@ -1,22 +1,20 @@ # tree-sitter-objectscript -ObjectScript UDL + routine grammars for [tree-sitter](https://github.com/tree-sitter/tree-sitter). +ObjectScript UDL grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter). -This crate publishes: +This crate publishes the UDL (`objectscript_udl`) grammar intended for `.cls` +files. + +It includes: -For UDL (`objectscript_udl`, intended for `.cls`): - `LANGUAGE_OBJECTSCRIPT_UDL` - `UDL_NODE_TYPES` - `UDL_HIGHLIGHTS_QUERY` - `UDL_INJECTIONS_QUERY` - `UDL_INDENTS_QUERY` -For routine headers/files (`objectscript_routine`, for `.mac`, `.inc`, `.int`, `.rtn`): -- `LANGUAGE_OBJECTSCRIPT_ROUTINE` -- `ROUTINE_NODE_TYPES` -- `ROUTINE_HIGHLIGHTS_QUERY` -- `ROUTINE_INJECTIONS_QUERY` -- `ROUTINE_INDENTS_QUERY` +If you want the routine grammar (`objectscript_routine`), use +`tree-sitter-objectscript-routine`. If you want the playground/snippet grammar (`objectscript`), use `tree-sitter-objectscript-playground`. diff --git a/cargo_readme_playground.md b/cargo_readme_playground.md index f6c8b80..3473329 100644 --- a/cargo_readme_playground.md +++ b/cargo_readme_playground.md @@ -18,5 +18,5 @@ It includes: For full class-file parsing (`objectscript_udl`), use the `tree-sitter-objectscript` crate. -For full routine parsing (with routine header or compiled version) (`objectscript_routine`), also use the -`tree-sitter-objectscript` crate. +For full routine parsing (`objectscript_routine`), use the +`tree-sitter-objectscript-routine` crate. diff --git a/cargo_readme_routine.md b/cargo_readme_routine.md new file mode 100644 index 0000000..048aec6 --- /dev/null +++ b/cargo_readme_routine.md @@ -0,0 +1,23 @@ +# tree-sitter-objectscript-routine + +ObjectScript routine grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter). + +This crate publishes the `objectscript_routine` grammar for routine files like +`.mac`, `.inc`, `.int`, and `.rtn`. + +It includes: + +- `LANGUAGE_OBJECTSCRIPT_ROUTINE` +- `NODE_TYPES` +- `HIGHLIGHTS_QUERY` +- `INJECTIONS_QUERY` +- `INDENTS_QUERY` + +For class-file parsing (`objectscript_udl`), use the +`tree-sitter-objectscript` crate. + +For playground/snippet parsing (`objectscript`), use the +`tree-sitter-objectscript-playground` crate. + +See [docs.rs/tree-sitter-objectscript-routine](https://docs.rs/tree-sitter-objectscript-routine/latest/tree_sitter_objectscript_routine/) +for API details and examples. diff --git a/common/common.mak b/common/common.mak index 93f7646..3769ca7 100644 --- a/common/common.mak +++ b/common/common.mak @@ -3,7 +3,7 @@ $(error Windows is not supported) endif HOMEPAGE_URL := https://github.com/intersystems/tree-sitter-objectscript -VERSION := 1.7.0 +VERSION := 1.7.1 # repository SRC_DIR := src diff --git a/core/src/parser.c b/core/src/parser.c index b356bd7..e4c4e0a 100644 --- a/core/src/parser.c +++ b/core/src/parser.c @@ -2004824,7 +2004824,7 @@ TS_PUBLIC const TSLanguage *tree_sitter_objectscript_core(void) { .metadata = { .major_version = 1, .minor_version = 7, - .patch_version = 0, + .patch_version = 1, }, }; return &language; diff --git a/docs/c4.md b/docs/c4.md index 4de4d8b..c582edb 100644 --- a/docs/c4.md +++ b/docs/c4.md @@ -315,7 +315,7 @@ sequenceDiagram - Binding surface varies by language: - Node exports `objectscript`, `objectscript_udl`, and `objectscript_routine` - Python wheel packages currently ship `tree_sitter_objectscript`, `tree_sitter_objectscript_udl`, and `tree_sitter_objectscript_routine` - - Rust is split into two crates: `tree-sitter-objectscript` (UDL + routine) and `tree-sitter-objectscript-playground` (playground) + - Rust is split into three crates: `tree-sitter-objectscript` (UDL), `tree-sitter-objectscript-routine` (routine), and `tree-sitter-objectscript-playground` (playground) - Go/Swift/C expose all five grammar entry points (`objectscript`, `objectscript_udl`, `objectscript_core`, `objectscript_expr`, `objectscript_routine`) - Injection queries require corresponding tree-sitter grammars to be installed (SQL, HTML, Python, etc.) diff --git a/docs/design-doc.md b/docs/design-doc.md index 5c12494..44a2841 100644 --- a/docs/design-doc.md +++ b/docs/design-doc.md @@ -299,7 +299,8 @@ Each target is a complete tree-sitter grammar. `objectscript` is the playground - [x] C binding (headers and library) - [x] Expose `objectscript`, `objectscript_udl`, and `objectscript_routine` entry points across bindings (plus `core`/`expr` where supported) - [x] Rust crates expose current constants: - - `tree-sitter-objectscript`: `LANGUAGE_OBJECTSCRIPT_UDL`, `LANGUAGE_OBJECTSCRIPT_ROUTINE` + - `tree-sitter-objectscript`: `LANGUAGE_OBJECTSCRIPT_UDL` + - `tree-sitter-objectscript-routine`: `LANGUAGE_OBJECTSCRIPT_ROUTINE` - `tree-sitter-objectscript-playground`: `LANGUAGE_OBJECTSCRIPT` ### Phase 6: Editor Integrations diff --git a/docs/usage-examples.md b/docs/usage-examples.md index 862310c..3bd5969 100644 --- a/docs/usage-examples.md +++ b/docs/usage-examples.md @@ -102,7 +102,7 @@ tree_sitter.Query(lang_playground, tree_sitter_objectscript.HIGHLIGHTS_QUERY) tree_sitter.Query(lang_routine, tree_sitter_objectscript_routine.HIGHLIGHTS_QUERY) ``` -## Rust Example (UDL + routine crate) +## Rust Example (UDL crate) ```rust use tree_sitter::Parser; @@ -116,11 +116,11 @@ fn main() { } ``` -Routine grammar from the same crate: +## Rust Example (Routine crate) ```rust use tree_sitter::Parser; -use tree_sitter_objectscript::LANGUAGE_OBJECTSCRIPT_ROUTINE; +use tree_sitter_objectscript_routine::LANGUAGE_OBJECTSCRIPT_ROUTINE; fn main() { let mut parser = Parser::new(); diff --git a/expr/src/parser.c b/expr/src/parser.c index c40748b..957361f 100644 --- a/expr/src/parser.c +++ b/expr/src/parser.c @@ -19637,7 +19637,7 @@ TS_PUBLIC const TSLanguage *tree_sitter_objectscript_expr(void) { .metadata = { .major_version = 1, .minor_version = 7, - .patch_version = 0, + .patch_version = 1, }, }; return &language; diff --git a/objectscript/src/parser.c b/objectscript/src/parser.c index 86372be..bc04e33 100644 --- a/objectscript/src/parser.c +++ b/objectscript/src/parser.c @@ -2186977,7 +2186977,7 @@ TS_PUBLIC const TSLanguage *tree_sitter_objectscript(void) { .metadata = { .major_version = 1, .minor_version = 7, - .patch_version = 0, + .patch_version = 1, }, }; return &language; diff --git a/objectscript_routine/src/parser.c b/objectscript_routine/src/parser.c index c543b0d..1d51267 100644 --- a/objectscript_routine/src/parser.c +++ b/objectscript_routine/src/parser.c @@ -2572440,7 +2572440,7 @@ TS_PUBLIC const TSLanguage *tree_sitter_objectscript_routine(void) { .metadata = { .major_version = 1, .minor_version = 7, - .patch_version = 0, + .patch_version = 1, }, }; return &language; diff --git a/package-lock.json b/package-lock.json index ec56099..82540d9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "tree-sitter-objectscript", - "version": "1.7.0", + "version": "1.7.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "tree-sitter-objectscript", - "version": "1.7.0", + "version": "1.7.1", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 0d107bc..be4fa7d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tree-sitter-objectscript", - "version": "1.7.0", + "version": "1.7.1", "description": "Tree Sitter Grammar for InterSystems ObjectScript", "scripts": { "install": "node-gyp-build", diff --git a/pyproject.toml b/pyproject.toml index 1ccbf8b..716d602 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta" [project] name = "tree-sitter-objectscript" description = "Objectscript grammar for tree-sitter" -version = "1.7.0" +version = "1.7.1" keywords = ["incremental", "parsing", "tree-sitter", "objectscript"] classifiers = [ "Intended Audience :: Developers", diff --git a/scripts/rust_routine_crate.sh b/scripts/rust_routine_crate.sh new file mode 100755 index 0000000..11bc236 --- /dev/null +++ b/scripts/rust_routine_crate.sh @@ -0,0 +1,85 @@ +#!/usr/bin/env bash +set -euo pipefail + +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +TEMPLATE_DIR="$ROOT_DIR/bindings/rust-routine" + +usage() { + cat < + scripts/rust_routine_crate.sh package [-- ] + scripts/rust_routine_crate.sh publish [-- ] +USAGE +} + +stage_routine_crate() { + local dest="$1" + + mkdir -p "$dest/common" \ + "$dest/objectscript_routine/src/tree_sitter" \ + "$dest/objectscript_routine/queries" + + cp -f "$TEMPLATE_DIR/Cargo.toml" "$dest/Cargo.toml" + cp -f "$TEMPLATE_DIR/build.rs" "$dest/build.rs" + cp -f "$TEMPLATE_DIR/lib.rs" "$dest/lib.rs" + + cp -f "$ROOT_DIR/LICENSE" "$dest/LICENSE" + cp -f "$ROOT_DIR/cargo_readme_routine.md" "$dest/cargo_readme_routine.md" + + cp -f "$ROOT_DIR/common/scanner.h" "$dest/common/scanner.h" + cp -f "$ROOT_DIR/objectscript_routine/src/parser.c" "$dest/objectscript_routine/src/parser.c" + cp -f "$ROOT_DIR/objectscript_routine/src/scanner.c" "$dest/objectscript_routine/src/scanner.c" + cp -f "$ROOT_DIR/objectscript_routine/src/node-types.json" "$dest/objectscript_routine/src/node-types.json" + cp -f "$ROOT_DIR/objectscript_routine/src/tree_sitter/parser.h" "$dest/objectscript_routine/src/tree_sitter/parser.h" + + cp -f "$ROOT_DIR/objectscript_routine/queries/highlights.scm" "$dest/objectscript_routine/queries/highlights.scm" + cp -f "$ROOT_DIR/objectscript_routine/queries/indents.scm" "$dest/objectscript_routine/queries/indents.scm" + cp -f "$ROOT_DIR/objectscript_routine/queries/injections.scm" "$dest/objectscript_routine/queries/injections.scm" +} + +if [[ $# -lt 1 ]]; then + usage + exit 1 +fi + +cmd="$1" +shift + +case "$cmd" in + stage) + if [[ $# -ne 1 ]]; then + usage + exit 1 + fi + dest="$1" + rm -rf "$dest" + mkdir -p "$dest" + stage_routine_crate "$dest" + echo "$dest" + ;; + package|publish) + args=("$@") + if [[ ${#args[@]} -gt 0 && "${args[0]}" == "--" ]]; then + args=("${args[@]:1}") + fi + + tmpdir="$(mktemp -d "${TMPDIR:-/tmp}/tsroutine.XXXXXX")" + cleanup() { + rm -rf "$tmpdir" + } + trap cleanup EXIT + + stage_routine_crate "$tmpdir" + + if [[ "$cmd" == "package" ]]; then + cargo package --manifest-path "$tmpdir/Cargo.toml" "${args[@]}" + else + cargo publish --manifest-path "$tmpdir/Cargo.toml" "${args[@]}" + fi + ;; + *) + usage + exit 1 + ;; +esac diff --git a/tree-sitter.json b/tree-sitter.json index 316076f..a6e5491 100644 --- a/tree-sitter.json +++ b/tree-sitter.json @@ -97,7 +97,7 @@ } ], "metadata": { - "version": "1.7.0", + "version": "1.7.1", "license": "MIT", "description": "ObjectScript grammars for tree-sitter", "namespace": "io.github.treesitter.objectscript", diff --git a/udl/src/parser.c b/udl/src/parser.c index 32a222e..58d4691 100644 --- a/udl/src/parser.c +++ b/udl/src/parser.c @@ -2121213,7 +2121213,7 @@ TS_PUBLIC const TSLanguage *tree_sitter_objectscript_udl(void) { .metadata = { .major_version = 1, .minor_version = 7, - .patch_version = 0, + .patch_version = 1, }, }; return &language;