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 = "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.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
    

Release files for tree-sitter-objectscript 1.9.18

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 1.9.18
File Size Uploaded
tree_sitter_objectscript-1.9.18.tar.gz 8.8 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for tree-sitter-objectscript 1.9.18
File
tree_sitter_objectscript-1.9.18-cp38-abi3-win_arm64.whl CPython 3.8 abi3 Windows ARM64 Details
tree_sitter_objectscript-1.9.18-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details
tree_sitter_objectscript-1.9.18-cp38-abi3-musllinux_1_2_x86_64.whl CPython 3.8 abi3 Linux musl 1.2+ x86-64 Details
tree_sitter_objectscript-1.9.18-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.9.18-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.8 abi3 Linux glibc 2.17+ ARM64 Details
tree_sitter_objectscript-1.9.18-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details
tree_sitter_objectscript-1.9.18-cp38-abi3-macosx_10_9_x86_64.whl CPython 3.8 abi3 macOS 10.9+ x86-64 Details

Total release size: 26.6 MB

Release files / tree_sitter_objectscript-1.9.18.tar.gz

Download URL tree_sitter_objectscript-1.9.18.tar.gz
Size 8.8 MB
Tags Source
SHA-256 checksum
How to use checksums
94c449fb0b7c0d1fd65ca1e04fba5eb05fe474b716198196210791525f14d74b
BLAKE2b-256 checksum
How to use checksums
98f6f8042e5ffbfa1660e901b4ce0311d4529abc05d2ef39752b01c64e3ba2e9
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.9.18-cp38-abi3-win_arm64.whl

Download URL tree_sitter_objectscript-1.9.18-cp38-abi3-win_arm64.whl
Size 2.4 MB
Tags CPython 3.8 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
3f017e0a306de167486366d92cada06c735aec28b03ea9536bfcf4f4a7e3e3b8
BLAKE2b-256 checksum
How to use checksums
011a9c057c9d552dcabc8071f6c6e181c204ea3c294b316c6132399c9c3e8fbe
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.9.18-cp38-abi3-win_amd64.whl

Download URL tree_sitter_objectscript-1.9.18-cp38-abi3-win_amd64.whl
Size 2.4 MB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
9720329dcb1ffd9cbd94fa6103db8f115b960518a907e8d66cf90b3ea2c50b57
BLAKE2b-256 checksum
How to use checksums
352bc9d5d19fcff0e9d12052d5e70bc19bc413c238c4e8abd3dbc755e05ceb95
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.9.18-cp38-abi3-musllinux_1_2_x86_64.whl

Download URL tree_sitter_objectscript-1.9.18-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
080d8e59cf977b52176360726ed8fcb61aece1d955783b5b7f1cf6defa25b783
BLAKE2b-256 checksum
How to use checksums
9f2c22c1e78e5ca6b8406835c2eb34aeee26f3dea0fd83f1f2b420fb785d5790
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.9.18-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL tree_sitter_objectscript-1.9.18-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 2.6 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
f19410a3d5f89e48275e8cb807e5cf35029c78511cb0bf386eb4bc9cf09dabdf
BLAKE2b-256 checksum
How to use checksums
c7c7ce3bde9c961c7f81820673248a5ccb8ea5bbd045ea6572aab5775c45bf30
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.9.18-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL tree_sitter_objectscript-1.9.18-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 2.7 MB
Tags CPython 3.8 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
79e838ebae6724e1c2cd2222bd20e595199db5cb36bc5d9e079820eda07f6667
BLAKE2b-256 checksum
How to use checksums
85a5320125ca6e67b650b680cf20bd9a77b79586b1edf71e05078b80aaf84257
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.9.18-cp38-abi3-macosx_11_0_arm64.whl

Download URL tree_sitter_objectscript-1.9.18-cp38-abi3-macosx_11_0_arm64.whl
Size 2.7 MB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
3c2b41ed8fb9fbc82929dfbe9f96eeb614ec09ed22aa73d127245ab222b8bbe8
BLAKE2b-256 checksum
How to use checksums
496ff3165b7e19fad87952cec3fc6582c2c641b23905a7b7a35c25770fff6552
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.9.18-cp38-abi3-macosx_10_9_x86_64.whl

Download URL tree_sitter_objectscript-1.9.18-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
1bdd2432a6df23284cf71d6c524daefb3870716cdf9841aad9d26c1de29f0db1
BLAKE2b-256 checksum
How to use checksums
6e49dd9a99ef3c10c83fd16f00d81db29be5a74dd4db0a70611dc30156860997
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

1.9.19

8 release files

This release

1.9.18 This release

8 release files

1.9.17

8 release files

1.9.16

8 release files

1.9.15

8 release files

1.9.14

8 release files

1.9.13

8 release files

1.9.12

8 release files

1.9.9

8 release files

1.9.8

8 release files

1.9.7

8 release files

1.9.6

8 release files

1.9.5

8 release files

1.9.4

8 release files

1.9.3

8 release files

1.9.2

8 release files

1.9.1

8 release files

1.9.0

8 release files

1.8.9

8 release files

1.8.8

8 release files

1.8.7

8 release files

1.8.6

8 release files

1.8.5

8 release files

1.8.4

8 release files

1.8.3

8 release files

1.8.2

8 release files

1.8.1

9 release files

1.8.0

9 release files

1.7.13

9 release files

1.7.12

9 release files

1.7.11

9 release files

1.7.10

9 release files

1.7.9

9 release files

1.7.8

9 release files

1.7.7

9 release files

1.7.6

9 release files

1.7.5

9 release files

1.7.4

9 release files

1.7.3

9 release files

1.7.2

9 release files

1.7.1

9 release files

1.7.0

9 release files

1.6.3

9 release files

1.6.1

9 release files

1.6.0

9 release files

1.5.1

9 release files

1.5.0

9 release files

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