Expand description
Full recursive-descent parser for the Active alpha.
Supported surface language:
let name = expr[table]blocks withkey = expr- top-level and nested
key = expr env.NAME ?: defaultsecret("…")/secret(env.NAME)- integers, floats, bools, null, strings (single & double quoted)
- unit suffixes on numbers (
5s,512MiB,100/req/s…) → Quantity nodes - full string interpolation
"…${ident}…"(and nested simple expressions) - arrays
[ … ] - inline tables
{ k = v, … } - binary operators with correct precedence:
||&&==!=<<=>>=+-*/ - unary
-and! - parentheses for grouping
After parsing, a resolution pass turns Ident nodes that match let
bindings into Ref nodes and builds the dependency graph.
Structs§
- Lexed
- Result of tokenizing: the token stream, hard lexical errors, healing diagnostics, and the comments found along the way (trivia for the formatter).
- Lexer
- Parse
Options - Options controlling parsing and healing behavior.
- Token
Enums§
- PathSeg
- One segment of a patch path (spec §2.9): a table key, optionally
followed by an array index (
servers[0]lexes as Key+Index). - Token
Kind
Functions§
- parse
- parse_
file - Parse a file from the filesystem, resolving
includestatements against the file’s directory (spec §2.7). Includes are enabled regardless of the passed options’enable_includesflag; every other option is honored as given. - parse_
file_ with_ trust - Parse a file with overlay enforcement (C-052): identical to
parse_file, but everyincludemust carry a valid sibling signature fromtrusted(E032 otherwise). Use with--trust-keys; without it,parse_filepreserves legacy behavior exactly. - parse_
recovering - Parse and return the module even when diagnostics were recorded.
- parse_
text_ recovering_ with_ file - Parse buffer text as above but always return the module, even
when diagnostics were recorded. Tooling (editor diagnostics on
broken files) needs the partial tree; crucially, the file context
is preserved so
includestatements never fall back to resolving from the process working directory. - parse_
text_ with_ file - Parse buffer text as if it were the file at
path:includestatements resolve against the file’s directory (spec §2.7), and diagnostics carry the file’s identity. The language server’s dirty-buffer path (C-043): unsaved edits analyze with the saved file’s include context. Includes are enabled regardless of the passed options’enable_includesflag; every other option is honored as given. - parse_
with - validate_
patch_ path - Validate and split a patch path (
a.b[0].c) into segments. Keys follow identifier syntax (ASCII letter or_first, then ASCII alphanumerics or_); an index suffix[n]may repeat (a[0][1]walks nested arrays). Empty paths/segments, malformed brackets, and non-integer indices are E019 at parse time; missing targets are W004 at apply.