pub struct AdamParser { /* private fields */ }Expand description
Owns one immutable type/operation environment for repeatable root construction.
Install libraries and register types before construction. Each parse creates a fresh module collection and live graph; no execution state is shared.
§Examples
let mut parser = adam_lang::AdamParser::new(adam_lang::TypeRegistry::new(),
cel_parser::OpLookup::new());
let parsed = parser.parse_str("sheet app { cell x: i32 = 7; }")?;
assert_eq!(*parsed.read::<i32>(parsed.cell_names["x"].0).unwrap(), 7);Implementations§
Source§impl AdamParser
impl AdamParser
Sourcepub fn new(types: TypeRegistry, lookup: OpLookup) -> Self
pub fn new(types: TypeRegistry, lookup: OpLookup) -> Self
Takes ownership of types and operations, shared immutably with compiled factories.
§Examples
See AdamParser.
Sourcepub fn parse_str(&mut self, source: &str) -> Result<ParsedSheet, ParseError>
pub fn parse_str(&mut self, source: &str) -> Result<ParsedSheet, ParseError>
Constructs the sole root in a source module without propagation.
Reusable definitions may accompany the root. All definitions and inactive
branches check before construction. Zero or multiple roots require explicit
selection through crate::CompiledModules::instantiate_root.
§Errors
Returns syntax, checking, selection, construction or combined validation
errors. The error source retains the original owning crate::ModuleDiagnostic.
- Complexity: Module compilation, native construction and combined validation; adapting a diagnostic additionally scans O(n) source tokens.
§Examples
See AdamParser.