Back to Eqiora docs Skip to main content

SourceAstFactory

Struct SourceAstFactory 

pub struct SourceAstFactory;
Description

Checked factory for owned source AST values.

The factory is intentionally syntax-only. It gives parsers, elaborators, and source transforms one construction boundary without exposing mutable declaration fields or requiring a format-and-reparse cycle.

Implementations§

§

impl SourceAstFactory

pub fn document( connectors: Vec<ConnectorDecl>, components: Vec<ComponentDecl>, models: Vec<ModelDecl>, ) -> Result<Document, AstConstructionError>

Close one nonempty compilation unit into a formatter-compatible document.

A declarations-only document is valid source syntax for a package library. Executable compilation still requires at least one Model.

§Errors

Returns an error when the compilation unit is empty.

pub fn document_with_pure_operators( connectors: Vec<ConnectorDecl>, components: Vec<ComponentDecl>, pure_operators: Vec<PureOperatorDecl>, models: Vec<ModelDecl>, ) -> Result<Document, AstConstructionError>

Close one nonempty compilation unit including pure operators.

The three-argument Self::document constructor remains the compact compatibility entry point for clients that do not author operators.

§Errors

Returns an error when the compilation unit is empty.

pub fn flat_document( models: Vec<ModelDecl>, ) -> Result<Document, AstConstructionError>

Close one or more flat models into a formatter-compatible document.

§Errors

Returns an error when models is empty, matching the source grammar.

pub fn exact_integer( spelling: impl Into<String>, range: TextRange, ) -> Result<ExactIntegerSyntax, AstConstructionError>

Construct one exact integer token used by pure-operator syntax.

§Errors

Returns an error when spelling is not an unsigned decimal integer, does not fit in u64, or the source range is reversed.

pub fn pure_operator_formal( name: impl Into<String>, value_class: PureValueClassSyntax, range: TextRange, ) -> Result<PureOperatorFormal, AstConstructionError>

Construct one ordered pure-operator formal.

§Errors

Returns an error for an invalid name, value class, or source range.

pub fn pure_operator_expression( kind: PureOperatorExprKind, range: TextRange, ) -> Result<PureOperatorExpr, AstConstructionError>

Construct one bounded pure-operator expression.

§Errors

Returns an error for malformed exact syntax or a reversed source range.

pub fn pure_operator( visibility: VisibilitySyntax, name: impl Into<String>, formals: Vec<PureOperatorFormal>, result: PureValueClassSyntax, body: PureOperatorExpr, range: TextRange, ) -> Result<PureOperatorDecl, AstConstructionError>

Construct one top-level pure operator declaration.

§Errors

Returns an error for an invalid name, an empty formal list, duplicate formal names, malformed exact syntax, or a reversed source range.

pub fn connector( visibility: VisibilitySyntax, name: impl Into<String>, syntax: ConnectorSyntax, range: TextRange, ) -> Result<ConnectorDecl, AstConstructionError>

Construct one nominal Connector declaration.

§Errors

Returns an error for malformed visibility-independent source shape, name, expression, or byte range.

pub fn connector_quantity( name: impl Into<String>, dimension: Expr, ) -> Result<ConnectorQuantitySyntax, AstConstructionError>

Construct one named field-physical Connector quantity.

§Errors

Returns an error for a malformed member name or dimension expression.

pub fn component( visibility: VisibilitySyntax, name: impl Into<String>, items: Vec<ComponentItem>, range: TextRange, ) -> Result<ComponentDecl, AstConstructionError>

Construct one reusable Component declaration.

§Errors

Returns an error for an invalid source identifier, member shape, or byte range. Name resolution and component semantics remain compiler responsibilities.

pub fn component_parameter( visibility: VisibilitySyntax, name: impl Into<String>, dimension: Expr, default: Option<Expr>, range: TextRange, ) -> Result<ComponentParameterDecl, AstConstructionError>

Construct one component-local scalar Parameter.

§Errors

Returns an error for a malformed name, expression, or byte range.

pub fn component_port( visibility: VisibilitySyntax, name: impl Into<String>, syntax: PortSyntax, range: TextRange, ) -> Result<ComponentPortDecl, AstConstructionError>

Construct one component-local Port.

§Errors

Returns an error for malformed Port syntax, a name, or a byte range.

pub fn component_port_family( port: ComponentPortDecl, binder: BoundaryFamilyBinderSyntax, ) -> Result<ComponentPortFamilyDecl, AstConstructionError>

Construct one field-physical Port family over a complete exterior.

§Errors

Returns an error unless the Port is field-physical, its support names the binder member, and both declarations are structurally valid.

pub fn boundary_family_binder( member: impl Into<String>, set: impl Into<String>, range: TextRange, ) -> Result<BoundaryFamilyBinderSyntax, AstConstructionError>

Construct the restricted [member in complete_exterior] binder.

§Errors

Returns an error for malformed identifiers or a reversed range.

pub fn support_slot( visibility: VisibilitySyntax, name: impl Into<String>, syntax: SupportSlotSyntax, range: TextRange, ) -> Result<SupportSlotDecl, AstConstructionError>

Construct one component-local spatial-support slot.

§Errors

Returns an error for a malformed slot name, parent name, or byte range. Support-graph and visibility rules remain compiler responsibilities.

pub fn field_slot( name: impl Into<String>, support: impl Into<String>, dimension: Expr, shape: Option<ValueShapeSyntax>, range: TextRange, ) -> Result<FieldSlotDecl, AstConstructionError>

Construct one public, required continuum Field slot.

§Errors

Returns an error for malformed names, dimensions, value shapes, or byte ranges. Exact support and Field compatibility remain compiler checks.

pub fn model( name: impl Into<String>, items: Vec<Item>, range: TextRange, ) -> Result<ModelDecl, AstConstructionError>

Construct one named flat model from already checked Item values.

§Errors

Returns an error for an invalid source identifier or byte range.

pub fn domain( name: impl Into<String>, syntax: DomainSyntax, range: TextRange, ) -> Result<DomainDecl, AstConstructionError>

Construct a Domain declaration.

§Errors

Returns an error for malformed source shape, names, expressions, or ranges. Geometric and dimensional meaning remains a lowering check.

pub fn representation( name: impl Into<String>, syntax: RepresentationSyntax, range: TextRange, ) -> Result<RepresentationDecl, AstConstructionError>

Construct a Representation declaration.

§Errors

Returns an error for an invalid source identifier or byte range.

pub fn field( name: impl Into<String>, domain: Option<String>, representation: Option<String>, dimension: Expr, initial: f64, range: TextRange, ) -> Result<FieldDecl, AstConstructionError>

Construct a scalar or spatial Field declaration.

domain and representation must either both be present or both be absent, as required by the source grammar.

§Errors

Returns an error for an incomplete spatial scope, non-finite initial value, malformed expression, identifier, or byte range.

pub fn field_with_shape( name: impl Into<String>, domain: Option<String>, representation: Option<String>, shape: Option<ValueShapeSyntax>, dimension: Expr, initial: Option<f64>, range: TextRange, ) -> Result<FieldDecl, AstConstructionError>

Construct a scalar or shaped Field declaration.

shape = None preserves the legacy scalar spelling. An explicit shape is retained in source form for context-dependent lowering.

§Errors

Returns the same structural errors as Self::field, plus malformed exact shape extents.

pub fn parameter( name: impl Into<String>, dimension: Expr, initial: f64, range: TextRange, ) -> Result<ParameterDecl, AstConstructionError>

Construct a model-level scalar Parameter declaration.

§Errors

Returns an error for a non-finite value or malformed source shape.

pub fn port( name: impl Into<String>, syntax: PortSyntax, range: TextRange, ) -> Result<PortDecl, AstConstructionError>

Construct a model-level Port declaration.

§Errors

Returns an error for malformed Port syntax, names, or ranges.

pub fn clock( name: impl Into<String>, period: RationalSyntax, phase: RationalSyntax, range: TextRange, ) -> Result<ClockDecl, AstConstructionError>

Construct an exact periodic Clock declaration.

Rational reduction and nonzero-period checks remain semantic lowering checks, matching parsed source behavior.

§Errors

Returns an error for an invalid source identifier or byte range.

pub fn relation( name: impl Into<String>, activation: ActivationSyntax, domain: Option<String>, residuals: Vec<Expr>, range: TextRange, ) -> Result<RelationDecl, AstConstructionError>

Construct an implicit Relation with at least one residual.

§Errors

Returns an error for an empty residual set or malformed source shape.

pub fn relation_family( relation: RelationDecl, binder: BoundaryFamilyBinderSyntax, ) -> Result<RelationFamilyDecl, AstConstructionError>

Construct one continuous Relation family over a complete exterior.

§Errors

Returns an error unless the Relation is continuous, is attached to the binder member, and both declarations are structurally valid.

pub fn connection( syntax: ConnectionSyntax, ports: Vec<NamePath>, range: TextRange, ) -> Result<ConnectionDecl, AstConstructionError>

Construct a signal or conserving Connection with at least two Ports.

§Errors

Returns an error for insufficient members or malformed paths/ranges.

pub fn boundary_connection( binder: Option<BoundaryFamilyBinderSyntax>, ports: Vec<BoundaryPortReferenceSyntax>, range: TextRange, ) -> Result<BoundaryConnectionDecl, AstConstructionError>

Construct one conserving Connection with boundary-family Port references.

§Errors

Returns an error for fewer than two Ports, malformed references, or a declaration containing neither a family binder nor a selector.

pub fn spatial_periodic_boundary_connection( ports: Vec<BoundaryPortReferenceSyntax>, range: TextRange, ) -> Result<BoundaryConnectionDecl, AstConstructionError>

Construct one exact spatial-periodic pair in a closed Model.

§Errors

Returns an error unless there are exactly two boundary Ports.

pub fn boundary_port_reference( port: NamePath, selector: Option<BoundaryPortSelectorSyntax>, ) -> Result<BoundaryPortReferenceSyntax, AstConstructionError>

Construct one Port path with an optional exact boundary selector.

§Errors

Returns an error for a malformed path or selector.

pub fn boundary_port_selector( member: impl Into<String>, target: impl Into<String>, range: TextRange, ) -> Result<BoundaryPortSelectorSyntax, AstConstructionError>

Construct the closed [member = target] Port selector.

§Errors

Returns an error for malformed identifiers or a reversed range.

pub fn boundary( ports: Vec<NamePath>, range: TextRange, ) -> Result<BoundaryDecl, AstConstructionError>

Construct a nonempty public model boundary.

§Errors

Returns an error for an empty boundary or malformed paths/ranges.

pub fn instance( name: impl Into<String>, definition: NamePath, bindings: Vec<ParameterBindingDecl>, range: TextRange, ) -> Result<InstanceDecl, AstConstructionError>

Construct one compile-time component instance.

§Errors

Returns an error for malformed names, bindings, or ranges.

pub fn instance_with_support_bindings( name: impl Into<String>, definition: NamePath, bindings: Vec<ParameterBindingDecl>, support_bindings: Vec<SupportBindingDecl>, range: TextRange, ) -> Result<InstanceDecl, AstConstructionError>

Construct one compile-time component instance with spatial supports.

§Errors

Returns an error for malformed names, either binding family, or ranges.

pub fn instance_with_slot_bindings( name: impl Into<String>, definition: NamePath, bindings: Vec<ParameterBindingDecl>, support_bindings: Vec<SupportBindingDecl>, field_bindings: Vec<FieldBindingDecl>, range: TextRange, ) -> Result<InstanceDecl, AstConstructionError>

Construct one compile-time component instance with occurrence-bound support and Field slots.

§Errors

Returns an error for malformed names, any binding family, or ranges.

pub fn instance_with_boundary_set_bindings( name: impl Into<String>, definition: NamePath, bindings: Vec<ParameterBindingDecl>, support_bindings: Vec<SupportBindingDecl>, boundary_set_bindings: Vec<BoundarySetBindingDecl>, field_bindings: Vec<FieldBindingDecl>, range: TextRange, ) -> Result<InstanceDecl, AstConstructionError>

Construct one compile-time component instance with every closed binding family, including finite complete-exterior bindings.

§Errors

Returns an error for malformed names, any binding family, or ranges.

pub fn parameter_binding( parameter: impl Into<String>, value: Expr, range: TextRange, ) -> Result<ParameterBindingDecl, AstConstructionError>

Construct one named component Parameter binding.

§Errors

Returns an error for a malformed target, expression, or byte range.

pub fn support_binding( slot: impl Into<String>, target: impl Into<String>, range: TextRange, ) -> Result<SupportBindingDecl, AstConstructionError>

Construct one named component spatial-support binding.

§Errors

Returns an error for a malformed slot, target, or byte range.

pub fn boundary_set_binding( slot: impl Into<String>, members: Vec<BoundarySetMemberSyntax>, range: TextRange, ) -> Result<BoundarySetBindingDecl, AstConstructionError>

Construct one finite complete-exterior support binding.

Empty member lists remain syntactically representable so semantic validation can issue the same contextual diagnostic as parsed source.

§Errors

Returns an error for malformed members, a slot, or a byte range.

pub fn boundary_set_member( target: impl Into<String>, range: TextRange, ) -> Result<BoundarySetMemberSyntax, AstConstructionError>

Construct one named member of a finite complete-exterior binding.

§Errors

Returns an error for a malformed target or byte range.

pub fn field_binding( slot: impl Into<String>, target: impl Into<String>, range: TextRange, ) -> Result<FieldBindingDecl, AstConstructionError>

Construct one named occurrence-bound Field binding.

§Errors

Returns an error for a malformed slot, target, or byte range.

pub fn expression( kind: ExprKind, range: TextRange, ) -> Result<Expr, AstConstructionError>

Construct one source expression from an owned recursive expression kind.

§Errors

Returns an error for malformed names, non-finite literals, child expressions, or byte ranges.

pub const fn rational(numerator: u64, denominator: u64) -> RationalSyntax

Construct unreduced rational source syntax.

Trait Implementations§

§

impl Clone for SourceAstFactory

§

fn clone(&self) -> SourceAstFactory

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for SourceAstFactory

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Default for SourceAstFactory

§

fn default() -> SourceAstFactory

Returns the “default value” for a type. Read more
§

impl Copy for SourceAstFactory

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
§

impl<Src, Scheme> ApproxFrom<Src, Scheme> for Src
where Scheme: ApproxScheme,

§

type Err = NoError

The error type produced by a failed conversion.
§

fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>

Convert the given value into an approximately equivalent representation.
§

impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Src
where Dst: ApproxFrom<Src, Scheme>, Scheme: ApproxScheme,

§

type Err = <Dst as ApproxFrom<Src, Scheme>>::Err

The error type produced by a failed conversion.
§

fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>

Convert the subject into an approximately equivalent representation.
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
§

impl<T> ByRef<T> for T

§

fn by_ref(&self) -> &T

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T, Dst> ConvAsUtil<Dst> for T

§

fn approx(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst>,

Approximate the subject with the default scheme.
§

fn approx_by<Scheme>(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst, Scheme>, Scheme: ApproxScheme,

Approximate the subject with a specific scheme.
§

impl<T> ConvUtil for T

§

fn approx_as<Dst>(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst>,

Approximate the subject to a given type with the default scheme.
§

fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst, Scheme>, Scheme: ApproxScheme,

Approximate the subject to a given type with a specific scheme.
§

fn into_as<Dst>(self) -> Dst
where Self: Sized + Into<Dst>,

Convert the subject to a given type.
§

fn try_as<Dst>(self) -> Result<Dst, Self::Err>
where Self: Sized + TryInto<Dst>,

Attempt to convert the subject to a given type.
§

fn value_as<Dst>(self) -> Result<Dst, Self::Err>
where Self: Sized + ValueInto<Dst>,

Attempt a value conversion of the subject to a given type.
§

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

§

fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> T
where Self: Distribution<T>,

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<Src> TryFrom<Src> for Src

§

type Err = NoError

The error type produced by a failed conversion.
§

fn try_from(src: Src) -> Result<Src, <Src as TryFrom<Src>>::Err>

Convert the given value into the subject type.
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<Src, Dst> TryInto<Dst> for Src
where Dst: TryFrom<Src>,

§

type Err = <Dst as TryFrom<Src>>::Err

The error type produced by a failed conversion.
§

fn try_into(self) -> Result<Dst, <Src as TryInto<Dst>>::Err>

Convert the subject into the destination type.
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<Src> ValueFrom<Src> for Src

§

type Err = NoError

The error type produced by a failed conversion.
§

fn value_from(src: Src) -> Result<Src, <Src as ValueFrom<Src>>::Err>

Convert the given value into an exactly equivalent representation.
§

impl<Src, Dst> ValueInto<Dst> for Src
where Dst: ValueFrom<Src>,

§

type Err = <Dst as ValueFrom<Src>>::Err

The error type produced by a failed conversion.
§

fn value_into(self) -> Result<Dst, <Src as ValueInto<Dst>>::Err>

Convert the subject into an exactly equivalent representation.
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,