Skip to main content

tree-sitter-objectscript

CI npm crates-udl crates-routine crates-playground pypi

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 (ships tree_sitter_objectscript, tree_sitter_objectscript_udl, and tree_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, and bindings/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.scm
  • indents.scm
  • injections.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/corpus contents with files from:
    • core/test/corpus
    • udl/test/corpus
    • objectscript_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-objectscript by 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.lua

    Add 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 = "8282d6a87ee45d231a6c66d125b26e91d3282831", 
              location = "udl",
              queries = "udl/queries",
            }
          }
    
          parsers.objectscript = {
            install_info = {
              url = "https://github.com/intersystems/tree-sitter-objectscript",
              revision = "8282d6a87ee45d231a6c66d125b26e91d3282831", 
              location = "objectscript",
              queries = "objectscript/queries",
            }
          }
    
          parsers.objectscript_routine = {
            install_info = {
              url = "https://github.com/intersystems/tree-sitter-objectscript",
              revision = "8282d6a87ee45d231a6c66d125b26e91d3282831", 
              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.scm

    Add 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, and objectscript

    :TSInstall objectscript_udl objectscript_routine objectscript
    

Metadata

Release files for tree-sitter-objectscript 2.0.0

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-objectscript 2.0.0
File Size Uploaded Provenance Actions
tree_sitter_objectscript-2.0.0.tar.gz 7.3 MB Without provenance Details for tree_sitter_objectscript-2.0.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for tree-sitter-objectscript 2.0.0
File Actions
tree_sitter_objectscript-2.0.0-cp38-abi3-win_arm64.whl CPython 3.8 abi3 Windows ARM64 Details for tree_sitter_objectscript-2.0.0-cp38-abi3-win_arm64.whl
tree_sitter_objectscript-2.0.0-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details for tree_sitter_objectscript-2.0.0-cp38-abi3-win_amd64.whl
tree_sitter_objectscript-2.0.0-cp38-abi3-musllinux_1_2_x86_64.whl CPython 3.8 abi3 Linux musl 1.2+ x86-64 Details for tree_sitter_objectscript-2.0.0-cp38-abi3-musllinux_1_2_x86_64.whl
tree_sitter_objectscript-2.0.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 abi3 Linux glibc 2.17+ x86-64 Details for tree_sitter_objectscript-2.0.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
tree_sitter_objectscript-2.0.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.8 abi3 Linux glibc 2.17+ ARM64 Details for tree_sitter_objectscript-2.0.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
tree_sitter_objectscript-2.0.0-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details for tree_sitter_objectscript-2.0.0-cp38-abi3-macosx_11_0_arm64.whl
tree_sitter_objectscript-2.0.0-cp38-abi3-macosx_10_9_x86_64.whl CPython 3.8 abi3 macOS 10.9+ x86-64 Details for tree_sitter_objectscript-2.0.0-cp38-abi3-macosx_10_9_x86_64.whl

Total release size: 22.2 MB

Release files / tree_sitter_objectscript-2.0.0.tar.gz

Download URL tree_sitter_objectscript-2.0.0.tar.gz
Size 7.3 MB
Tags Source
SHA-256 checksum
How to use checksums
a70dfa3691bf21064c51295929e987dec949b69b25a395ca93d600946519427a
BLAKE2b-256 checksum
How to use checksums
58370289f86d603be70733a0513a1e82b23f652809003eba81fb64b8727d521d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / tree_sitter_objectscript-2.0.0-cp38-abi3-win_arm64.whl

Download URL tree_sitter_objectscript-2.0.0-cp38-abi3-win_arm64.whl
Size 2.0 MB
Tags CPython 3.8 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
79b7af2fc513215976bace82e8e7bec8af87ea8286a5dfce3ab3ed8995455289
BLAKE2b-256 checksum
How to use checksums
016f83876a167477d3aa871247e3195e9666964ad19ae1f58abe4bab3c856c96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / tree_sitter_objectscript-2.0.0-cp38-abi3-win_amd64.whl

Download URL tree_sitter_objectscript-2.0.0-cp38-abi3-win_amd64.whl
Size 2.0 MB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
398819c153a5c04229c432ca8a82dd7bedf255eb4ec964828142439db61c1ef1
BLAKE2b-256 checksum
How to use checksums
a74d2566650d89a785f4779c9855c97112267d1e33c8bb6833a72c5db5c7fd8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / tree_sitter_objectscript-2.0.0-cp38-abi3-musllinux_1_2_x86_64.whl

Download URL tree_sitter_objectscript-2.0.0-cp38-abi3-musllinux_1_2_x86_64.whl
Size 2.2 MB
Tags CPython 3.8 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
4eddb8149653213b872b0b1499ba1daa4c3396751ad92ee97f422c0b0d370c14
BLAKE2b-256 checksum
How to use checksums
88563331cbea0bef302d0e797a5f1f70d6e64b15b10fbd7e80761600f3c18252
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / tree_sitter_objectscript-2.0.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL tree_sitter_objectscript-2.0.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 2.2 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
d4f6dae4afda420eab441d5846784a676d92f8410c093b322c8a9ad097ccaf23
BLAKE2b-256 checksum
How to use checksums
db88f727e05c7d99cb8c6c169a108a42d195480d8d5d6cddeef174e45042bf50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / tree_sitter_objectscript-2.0.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL tree_sitter_objectscript-2.0.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 2.3 MB
Tags CPython 3.8 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
6ca259bd5ee8fb15aeee23f75318bc385845118693ed02b5de78146cadafc225
BLAKE2b-256 checksum
How to use checksums
f9d490c1d84a4a36a972d929160382cfd1836831df9e2e77ea34f7cb7b722dd6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / tree_sitter_objectscript-2.0.0-cp38-abi3-macosx_11_0_arm64.whl

Download URL tree_sitter_objectscript-2.0.0-cp38-abi3-macosx_11_0_arm64.whl
Size 2.2 MB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
a9a275aee1a1bc545f3d471ddcb9cea339c162bff93ebd0091cf63542c1e5c25
BLAKE2b-256 checksum
How to use checksums
b23fd38e710e9c49a644c2bc2bda48c5053bc2e7ee847d155717029d3986b060
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / tree_sitter_objectscript-2.0.0-cp38-abi3-macosx_10_9_x86_64.whl

Download URL tree_sitter_objectscript-2.0.0-cp38-abi3-macosx_10_9_x86_64.whl
Size 2.0 MB
Tags CPython 3.8 abi3 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
09f105ee31946dc3f06ffdc39aa1df6a2d14d0101aa57db8ea7911c438f6b0d6
BLAKE2b-256 checksum
How to use checksums
7a724f2deda5135864c7b1edaa674042597b359b137ba78fd7f33d533cfac15c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for tree-sitter-objectscript 2.0.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.0.0 This release

8 release files No provenance

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