tree-sitter-lmscript reference
Reference tables for tree-sitter-lmscript AST nodes, injection queries, companion parser rules, and test exit codes.
AST node and grammar surface
| Node / Artifact | Kind | Description |
|---|---|---|
| data_block_statement | Outer AST node | Wraps a queued data block header, body (lmcode_body or data_body), and block_closer |
| block_marker | Outer AST node | Header token such as _lmcode_ or _dsl_ with cli, install, or schema attributes |
| lmcode_body | Outer AST node | Exact physical byte range of the inner lmcode chunk excluding header and end _lmcode_ |
| data_body | Outer AST node | Body node for non-lmcode data blocks |
| block_closer | Outer AST node | Closing delimiter line such as end _lmcode_ or end _dsl_ |
| lmscript_lmcode_body | Companion root node | Root node produced by the lmcode-body/ companion parser for injected lmcode_body ranges |
| queries/injections.scm | Query file | Tree-sitter injection query binding lmcode_body to lmscript_lmcode |
| scripts/conformance.mjs | Verification script | Runs public corpus checks, failing controls, mutant gates, and optional --live scan |
Standard REST and CLI interfaces recognized by the grammar
| Interface | Canonical declaration | Behavior |
|---|---|---|
| RestGet | interface RestGet(exchange: RestExchange) -> void | HTTP GET endpoint bound by path annotation such as @"/users/:id" |
| RestPost | interface RestPost(exchange: RestExchange) -> void | HTTP POST endpoint bound by path annotation such as @"/users" |
| RestPut | interface RestPut(exchange: RestExchange) -> void | HTTP PUT endpoint bound by path annotation such as @"/users/:id" |
| RestDelete | interface RestDelete(exchange: RestExchange) -> void | HTTP DELETE endpoint bound by path annotation such as @"/users/:id" |
| RestPatch | interface RestPatch(exchange: RestExchange) -> void | HTTP PATCH endpoint bound by path annotation such as @"/users/:id" |
| RestHead | interface RestHead(exchange: RestExchange) -> void | HTTP HEAD endpoint bound by path annotation |
| RestOptions | interface RestOptions(exchange: RestExchange) -> void | HTTP OPTIONS endpoint bound by path annotation |
| RestHandler | interface RestHandler(exchange: RestExchange) -> void | Method-prefixed (@"POST /users") or rest_route(method, path, annotation) handler |
| CliCommand | interface CliCommand(exchange: RestExchange) -> void | Stateless CLI subcommand entry dispatched by rest_cli(args) |
| CliOption | interface CliOption(exchange: RestExchange) -> void | Stateless CLI flag or option entry dispatched before CliCommand by rest_cli(args) |
Verification exit statuses
| Exit code | Stage | Result | Condition |
|---|---|---|---|
| 0 | parse / test | Exit 0 | Grammar generation, the generated-file freshness check and the corpus conformance cases all pass |
| 1 | conformance | Exit 1 | A corpus conformance case fails; the failing case is printed with a FAIL prefix |
| 1 | freshness | Exit 1 | Generated src/parser.c, grammar.json, or node-types.json differs from grammar.js after tree-sitter generate |