Skip to main content

AdamParser

Struct AdamParser 

Source
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

Source

pub fn new(types: TypeRegistry, lookup: OpLookup) -> Self

Takes ownership of types and operations, shared immutably with compiled factories.

§Examples

See AdamParser.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.