feat: add routine grammar, update core grammar, update highlighting#29
Merged
davem-intersys merged 5 commits intointersystems:mainfrom Mar 20, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR adds a new grammar,
objectscript_routine, which parses routine headers, providing syntax highlighting for.mac,int, and.incfiletypes. Additionally, this PR solves a few bugs and updates highlighting.Key Changes
tree-sitter-objectscriptrust crate now includes the routine grammar and support for.mac,.inc,.intThe Routine Grammar
The routine header allows

Typeto be either mac, inc, or int.This grammar provides highlighting for routines, and was added to the rust
tree-sitter-objectscriptcrate andtree-sitter-objectscript-playgroundcrate.Special case of do argumentless commands
There is a special case of do commands where you can have something like:
What this means is: run the dotted statements first, and then run the commands that are on the first line after the do command. Before, this syntax was not supported in our grammar. Now, it works as expected:

This case has been added as a test case in core.
Special case of for loop argumentless blocks
In the case where the is a comment immediately after a the keyword for, it used to get registered as the old for version,

making it so the block version would fail:
This PR fixes this, and it is parsing as expected now:
Variadic Args in Method Definition
Before, variadic args were only allowed to be passed when calling a method, now they are also allowed in the method definition.

Update Highlighting
A big part of this PR is also to update highlighting. Some changes include:
Before Changes:
After Changes:


Sync Queries Bug
Before, a bug was causing the highlights from expr to get copied twice into the udl highlights, since udl is composed of expr and core, and the script was accidentally copying the entire core highlights (which also includes expr highlights) rather than just the core specifc highlights. This is fixed, now only content within LOCAL blocks are copied.
Git Hook Automation
Once someone runs
make installhooksand has the git hook on their local computer, the git hook will automatically run on a commit, checking that queries in the python binding match the highlights in the grammar folders, and update the python binding if needed. It will also run a lint check and all of the parser tests.