tree-sitter-lmscript skill

Use tree-sitter-lmscript to parse outer .lms programs, locate _lmcode_ data block boundaries, and inject the companion lmscript_lmcode grammar.

Purpose

Parse LMScript statements, imports, packages, recover points, command literals, formatted strings, and queued _lmcode_ / data blocks with accurate byte ranges.

When to use it

Use tree-sitter-lmscript when building editor highlighting, code navigation, or static analysis tools for .lms files and their embedded _lmcode_ blocks.

Install

Use Node 24+, a C compiler, and tree-sitter-cli 0.27.1 installed in a private prefix, then run npm test.

Commands

npm install --prefix /tmp/lmscript-tree-sitter tree-sitter-cli@0.27.1
export TREE_SITTER=/tmp/lmscript-tree-sitter/node_modules/.bin/tree-sitter
npm test
node scripts/conformance.mjs

Inputs and outputs

Safety rules

Worked examples

# Run live corpus verification when local mono and skills-scripts checkouts are present
export MONO_ROOT=/path/to/lmctl-mono
export SKILLS_ROOT=/path/to/skills-scripts
node scripts/conformance.mjs --live

Errors and exit codes

Exit codeStageResultCondition
0parse / testExit 0Grammar generation, the generated-file freshness check and the corpus conformance cases all pass
1conformanceExit 1A corpus conformance case fails; the failing case is printed with a FAIL prefix
1freshnessExit 1Generated src/parser.c, grammar.json, or node-types.json differs from grammar.js after tree-sitter generate

How to verify

export TREE_SITTER=/tmp/lmscript-tree-sitter/node_modules/.bin/tree-sitter
npm test