Diagnostics
Tea Script diagnostics are structured so editor, sandbox, merge-gate, and future language-server adapters can share the same contract.
Diagnostic Shape
Section titled “Diagnostic Shape”Validator output is JSON with an ok flag and a diagnostics array:
{ "ok": false, "diagnostics": [ { "stage": "compile", "severity": "error", "code": "expected_expression", "message": "Expected Tea Script expression.", "line": 3, "column": 12 } ]}The stable public fields are:
| Field | Meaning |
|---|---|
stage |
Validation phase such as compile, typecheck, or a merge-gate guardrail. |
severity |
Diagnostic severity. Current authoring failures are errors. |
code |
Stable diagnostic identifier when available. |
message |
Human-readable explanation. |
line |
1-based source line. |
column |
1-based source column. |
Validation Owners
Section titled “Validation Owners”The validator uses the same Tea Script parser, semantic analysis, and lowering path as compilation. OpenChart merge gates call that validator before compiling indicator source, then enforce additional repository guardrails such as output column limits.
Unsupported language forms are intentionally rejected early. Examples include
import, export, module.exports, arbitrary TypeScript declarations, and
ambient runtime-context access through ctx.