pub struct ParseCtx<'a> {
pub lower: &'a dyn Fn(&str, Vec<Arg>) -> ParseResult<StepKind>,
pub modules: &'a ModuleTable,
pub reserved: &'a HashSet<String>,
pub funcs: RefCell<Vec<HashSet<String>>>,
pub imports: RefCell<Vec<Vec<String>>>,
pub func_exports: RefCell<Vec<String>>,
pub type_exports: RefCell<Vec<String>>,
pub forward: RefCell<Vec<HashSet<String>>>,
pub current_line: RefCell<usize>,
}Expand description
Parse context: shared lowering dispatcher plus module table for
static call resolution, with FUNC/import frames per braced body.
Fields§
§lower: &'a dyn Fn(&str, Vec<Arg>) -> ParseResult<StepKind>§modules: &'a ModuleTable§reserved: &'a HashSet<String>Host-registered function names for the FUNC shadow check
(empty when hosts are unknown).
funcs: RefCell<Vec<HashSet<String>>>FUNC scopes (innermost last) and import frames, pushed per
braced body; short borrows only,
never held across recursive parses.
imports: RefCell<Vec<Vec<String>>>§func_exports: RefCell<Vec<String>>EXPORT func names in source order, validated at end of parse
(forward references allowed).
type_exports: RefCell<Vec<String>>EXPORT TYPE names in source order, validated at end of parse
(forward references allowed). Separate from func exports so the
MCP server never confuses a type for a tool.
forward: RefCell<Vec<HashSet<String>>>Top-level FUNC names pre-declared before lowering, so forward
references resolve regardless of order. Separate from funcs
frames so duplicate detection in declare_func stays intact;
visible_snapshot unions this set.
current_line: RefCell<usize>1-based source line of the statement currently lowering (the innermost split statement; updated per statement by the body loops, read as the base for nested splits). Lets every error carry its statement’s line without threading it through every header function by hand.