Skip to main content

Module parser

Module parser 

Source

Structs§

ParsedScript
Parsed script with single-file EXPORT metadata. steps is the linear execution plan, exports the EXPORT names in source order, and func_docs maps top-level FUNC base names to (summary, docs) collected from the immediately preceding # comment block.
ScriptParser

Functions§

parse_expression_str
Parse one expression from source text with an empty module scope, for tooling that shows lowering without running (docs demos, explain output). No imports exist here, so bare function calls fail and qualified calls fail against the empty table; only INSPECT passes through untouched. Arithmetic, comparison, variables, env reads, keypaths, and literals lower normally, with literal only subtrees folded before flattening.
parse_guard_expr_str
parse_script
parse_script_with_exports
Parse without modules plus EXPORT metadata. Used by tests and tooling that lower with the shared mock.
parse_script_with_modules
Parse with a module provenance table so calls resolve statically: qualified MODULE::NAME checks membership, bare NAME resolves through SCRIPT definitions and IMPORTed modules, and anything else fails at parse time instead of at runtime.
parse_script_with_modules_and_exports
Parse with modules plus single-file EXPORT metadata and # doc comments for top-level FUNCs. Used by the MCP host; the linear runner keeps using parse_script_with_modules and ignores exports.
parse_script_with_preseed
Parse a snippet with an enclosing parse’s visible scope state, so re-parsed inner commands (async bodies) resolve calls identically. The snippet never defines, only reads: seeds affect lookup alone.