tree-sitter-objectscript
Tree-sitter grammars for InterSystems ObjectScript.
Grammars
This repository publishes five related grammars:
objectscript: playground/snippet grammar.objectscript_udl: class-file grammar for.cls.objectscript_core: routine/statement grammar.objectscript_expr: expression grammar.objectscript_routine: routine-file grammar for.mac,.inc,.rtn, and.int.
Grammar extension graph:
objectscript_expr -> objectscript_core -> objectscript_udl -> objectscript
objectscript_expr -> objectscript_core -> objectscript_routine
Packages
- npm:
tree-sitter-objectscript - PyPI:
tree-sitter-objectscript(shipstree_sitter_objectscript,tree_sitter_objectscript_udl, andtree_sitter_objectscript_routine) - Rust crates:
tree-sitter-objectscript(UDL grammar)tree-sitter-objectscript-routine(routine grammar)tree-sitter-objectscript-playground(playground grammar)
Bindings
Language bindings are available under bindings/:
- C:
bindings/c - Go:
bindings/go - Node.js:
bindings/node - Python:
bindings/python - Rust:
bindings/rust,bindings/rust-routine, andbindings/rust-playground - Swift:
bindings/swift
Quick binding checks from repo root:
nvm use
npm ci
cargo test --lib --package tree-sitter-objectscript
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install -U pip setuptools wheel pytest tree-sitter
python3 setup.py build_ext --inplace
PYTHONPATH=$PWD/bindings/python python3 -m pytest -q bindings/python/tests/test_binding.py
npm test
go test ./bindings/go/...
swift test
make test
The routine and playground Rust crates are staged from bindings/rust-routine and
bindings/rust-playground via helper scripts. See
CONTRIBUTING.md for the current local build workflow.
For Node bindings specifically, .nvmrc pins the expected Node version.
Quick Development
Install the tree-sitter CLI, then run commands from a grammar directory (objectscript, udl, core, expr, or objectscript_routine):
tree-sitter generate
tree-sitter test
tree-sitter build
For playground work:
tree-sitter build --wasm
tree-sitter playground
If you change an upstream grammar (expr or core), regenerate downstream grammars as needed (udl, objectscript, objectscript_routine).
Query Sync
scripts/sync_queries.py manages the canonical query trio for each grammar:
highlights.scmindents.scminjections.scm
It composes the layered query trees for core, udl, objectscript, and
objectscript_routine, then mirrors those composed files into the Python
binding query directories.
Corpus Sync
objectscript/test/corpus is treated as a synced corpus directory. On commit, the repository pre-commit hook:
- Replaces
objectscript/test/corpuscontents with files from:core/test/corpusudl/test/corpusobjectscript_routine/test/corpus
- Removes
objectscript/test/corpus/invalid.txt - Removes
objectscript/test/corpus/compiled-header.txt
Contributing
See CONTRIBUTING.md for setup, workflow, query sync, and binding test instructions.
References
Editor Integration
-
Zed On Zed, you can use
tree-sitter-objectscriptby downloading the InterSystems ObjectScript extension -
Neovim We currently have a PR open with
nvim-treesitter, and if that gets merged in, the setup process will be automated. However, this repo is currently archived, so for now do the following to setup the grammars in neovim:Step 1: Create
~/.config/nvim/lua/plugins/objectscript-treesitter.luaAdd the following content to that file: IMPORTANT: Make sure to replace the revision section with the commit that you want.
return { -- configure nvim-treesitter { "nvim-treesitter/nvim-treesitter", init = function() vim.filetype.add({ extension = { cls = "objectscript_udl", mac = "objectscript_routine", inc = "objectscript_routine", int = "objectscript_routine", rtn = "objectscript_routine" }, }) vim.api.nvim_create_autocmd("FileType", { pattern = { "objectscript_udl", "objectscript_routine" }, callback = function(args) vim.treesitter.start(args.buf) end, }) vim.api.nvim_create_autocmd('User', { pattern = 'TSUpdate', callback = function() local parsers = require("nvim-treesitter.parsers") parsers.objectscript_udl = { install_info = { url = "https://github.com/intersystems/tree-sitter-objectscript", revision = "58450fe03f6fa51de38ac689fbf0af63f455494a", location = "udl", queries = "udl/queries", } } parsers.objectscript = { install_info = { url = "https://github.com/intersystems/tree-sitter-objectscript", revision = "58450fe03f6fa51de38ac689fbf0af63f455494a", location = "objectscript", queries = "objectscript/queries", } } parsers.objectscript_routine = { install_info = { url = "https://github.com/intersystems/tree-sitter-objectscript", revision = "58450fe03f6fa51de38ac689fbf0af63f455494a", location = "objectscript_routine", queries = "objectscript_routine/queries", } } end}) end, opts = function(_, opts) opts.ensure_installed = opts.ensure_installed or {} for _, lang in ipairs({ "objectscript_udl", "objectscript_routine", "objectscript" }) do if not vim.tbl_contains(opts.ensure_installed, lang) then table.insert(opts.ensure_installed, lang) end end end, }, }
Step 2: Create
~/.config/nvim/after/queries/xml/injections.scmAdd the following content to that file:
;; extends ( element (STag (Name) @_start_tag) (content (CDSect (CData) @injection.content)) (ETag (Name) @_end_tag) (#eq? @_start_tag "Implementation") (#eq? @_end_tag "Implementation") (#set! injection.language "objectscript") ) ( element (STag (Name) @_start_tag) (content (CharData) @injection.content) (ETag (Name) @_end_tag) (#eq? @_start_tag "Implementation") (#eq? @_end_tag "Implementation") (#set! injection.language "objectscript") )
Step 3: Create
~/.config/nvim/queries/xml/highlights.scm;; XML declaration "xml" @keyword [ "version" "encoding" "standalone" ] @property (EncName) @string.special (VersionNum) @number [ "yes" "no" ] @boolean ;; Processing instructions (PI) @embedded (PI (PITarget) @keyword) ;; Element declaration (elementdecl "ELEMENT" @keyword (Name) @tag) (contentspec (_ (Name) @property)) "#PCDATA" @type.builtin [ "EMPTY" "ANY" ] @string.special.symbol [ "*" "?" "+" ] @operator ;; Entity declaration (GEDecl "ENTITY" @keyword (Name) @constant) (GEDecl (EntityValue) @string) (NDataDecl "NDATA" @keyword (Name) @label) ;; Parsed entity declaration (PEDecl "ENTITY" @keyword "%" @operator (Name) @constant) (PEDecl (EntityValue) @string) ;; Notation declaration (NotationDecl "NOTATION" @keyword (Name) @constant) (NotationDecl (ExternalID (SystemLiteral (URI) @string.special))) ;; Attlist declaration (AttlistDecl "ATTLIST" @keyword (Name) @tag) (AttDef (Name) @property) (AttDef (Enumeration (Nmtoken) @string)) (DefaultDecl (AttValue) @string) [ (StringType) (TokenizedType) ] @type.builtin (NotationType "NOTATION" @type.builtin) [ "#REQUIRED" "#IMPLIED" "#FIXED" ] @attribute ;; Entities (EntityRef) @constant ((EntityRef) @constant.builtin (#any-of? @constant.builtin "&" "<" ">" """ "'")) (CharRef) @constant (PEReference) @constant ;; External references [ "PUBLIC" "SYSTEM" ] @keyword (PubidLiteral) @string.special (SystemLiteral (URI) @markup.link) ;; Processing instructions (XmlModelPI "xml-model" @keyword) (StyleSheetPI "xml-stylesheet" @keyword) (PseudoAtt (Name) @property) (PseudoAtt (PseudoAttValue) @string) ;; Doctype declaration (doctypedecl "DOCTYPE" @keyword) (doctypedecl (Name) @type) ;; Tags (STag (Name) @tag) (ETag (Name) @tag) (EmptyElemTag (Name) @tag) ;; Attributes (Attribute (Name) @property) (Attribute (AttValue) @string) ;; Delimiters & punctuation [ "<?" "?>" "<!" "]]>" "<" ">" "</" "/>" ] @punctuation.delimiter [ "(" ")" "[" "]" ] @punctuation.bracket [ "\"" "'" ] @punctuation.delimiter [ "," "|" "=" ] @operator ;; Text (CharData) @markup ( element (STag (Name) @_start_tag) (content (CDSect (CData) @injection.content)) (ETag (Name) @_end_tag) (#eq? @_start_tag "Implementation") (#eq? @_end_tag "Implementation") (#set! priority 90) ) ( element (STag (Name) @_start_tag) (content (CharData) @injection.content) (ETag (Name) @_end_tag) (#eq? @_start_tag "Implementation") (#eq? @_end_tag "Implementation") (#set! priority 90) ) (CDSect (CDStart) @markup.heading (CData) @markup.raw "]]>" @markup.heading) ;; Misc (Comment) @comment (ERROR) @error
Step 4: Remove cached data from nvim if necessary (if previously installed)
rm -rf ~/.local/share/nvim/site/parser \ ~/.local/share/nvim/site/parser-info \ ~/.local/share/nvim/site/queries
Step 5: Open Neovim and Install
objectscript_udl,objectscript_routine, andobjectscript:TSInstall objectscript_udl objectscript_routine objectscript
Metadata
Release files for tree-sitter-objectscript 1.10.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tree_sitter_objectscript-1.10.0.tar.gz | 8.9 MB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| tree_sitter_objectscript-1.10.0-cp38-abi3-win_arm64.whl | CPython 3.8 | abi3 | Windows ARM64 | Details |
| tree_sitter_objectscript-1.10.0-cp38-abi3-win_amd64.whl | CPython 3.8 | abi3 | Windows x86-64 | Details |
| tree_sitter_objectscript-1.10.0-cp38-abi3-musllinux_1_2_x86_64.whl | CPython 3.8 | abi3 | Linux musl 1.2+ x86-64 | Details |
| tree_sitter_objectscript-1.10.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.8 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| tree_sitter_objectscript-1.10.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.8 | abi3 | Linux glibc 2.17+ ARM64 | Details |
| tree_sitter_objectscript-1.10.0-cp38-abi3-macosx_11_0_arm64.whl | CPython 3.8 | abi3 | macOS 11.0+ ARM64 | Details |
| tree_sitter_objectscript-1.10.0-cp38-abi3-macosx_10_9_x86_64.whl | CPython 3.8 | abi3 | macOS 10.9+ x86-64 | Details |
Total release size: 27.1 MB
Release files / tree_sitter_objectscript-1.10.0.tar.gz
| Download URL | tree_sitter_objectscript-1.10.0.tar.gz |
|---|---|
| Size | 8.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6e52fc2e14ce7145eac4234986e3dc2e69c227bcd203a88f4e423449eec689de
|
|
BLAKE2b-256 checksum How to use checksums |
5e67a3e9fe78eebf2df06af103ef89103b43d7f6c938de1dfe59104328d1feb8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / tree_sitter_objectscript-1.10.0-cp38-abi3-win_arm64.whl
| Download URL | tree_sitter_objectscript-1.10.0-cp38-abi3-win_arm64.whl |
|---|---|
| Size | 2.5 MB |
| Tags | CPython 3.8 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
e6bb0234149fb1c13a5ad0b1674722d7ba272c38e13ccca5c048278277da23c6
|
|
BLAKE2b-256 checksum How to use checksums |
d203517bc7471530cd8d429d8d2574f192fbded3613084683e00b169d74284c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / tree_sitter_objectscript-1.10.0-cp38-abi3-win_amd64.whl
| Download URL | tree_sitter_objectscript-1.10.0-cp38-abi3-win_amd64.whl |
|---|---|
| Size | 2.5 MB |
| Tags | CPython 3.8 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
b6ab0224e906a4b2be6b6d3ae4d79bad3b98eb2ac8a9e5eca48e06110640d995
|
|
BLAKE2b-256 checksum How to use checksums |
466d5cdb9053a29bac93f053ecf8c7f4d3596288d52b3f02f34ef0f9c303f9e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / tree_sitter_objectscript-1.10.0-cp38-abi3-musllinux_1_2_x86_64.whl
| Download URL | tree_sitter_objectscript-1.10.0-cp38-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 2.6 MB |
| Tags | CPython 3.8 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
96d38bfcea5b9f59be616e03690488ee4c6b3212fe30db4114d406540af1e4a6
|
|
BLAKE2b-256 checksum How to use checksums |
b4629b2e2e1b164aabb1811f60534c401e0575943a66d64ed51f91e094bdd572
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / tree_sitter_objectscript-1.10.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | tree_sitter_objectscript-1.10.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 2.7 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
168a94176c68f111ad947047e93382abe1b82fe360464ea51b00e2a4508c399d
|
|
BLAKE2b-256 checksum How to use checksums |
1bc0397df71ac91c0733cb6b5fed33ddac61114732a693467059c62e423ad4da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / tree_sitter_objectscript-1.10.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | tree_sitter_objectscript-1.10.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 2.8 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
0667a404235e648aadeea25409f699ccbb5be6f2c62afe3e2217b3b8db010654
|
|
BLAKE2b-256 checksum How to use checksums |
001d276c905ca62451e4c4453d830b211a9a331106aa9c69c240299c98fc1222
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / tree_sitter_objectscript-1.10.0-cp38-abi3-macosx_11_0_arm64.whl
| Download URL | tree_sitter_objectscript-1.10.0-cp38-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.8 MB |
| Tags | CPython 3.8 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
eb270e8551a65c35650942b14b14cf912f731f55b9a32bb5f0950669824d240f
|
|
BLAKE2b-256 checksum How to use checksums |
4a5e0fbcb63f85fc2e0726635a4e3cb3d2074236dbc48317ea7232058ac5a7c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / tree_sitter_objectscript-1.10.0-cp38-abi3-macosx_10_9_x86_64.whl
| Download URL | tree_sitter_objectscript-1.10.0-cp38-abi3-macosx_10_9_x86_64.whl |
|---|---|
| Size | 2.4 MB |
| Tags | CPython 3.8 abi3 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
85a01c245c44a41bcf07431cb1877f0db4a8a65e7e9e81e7eb760ca8f8ec66ec
|
|
BLAKE2b-256 checksum How to use checksums |
45ed48488348a55bad6f9dc0a5794d1bad3e8a23b35a3478bcbd695cb4a76846
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|