pub struct Builder<S: Eq + Hash> { /* private fields */ }
Expand description
A rain IR builder which consumes an AST and outputs IR, along with handling errors
Implementations§
Source§impl<'a, S: Eq + Hash + From<&'a str> + Borrow<str>> Builder<S>
impl<'a, S: Eq + Hash + From<&'a str> + Borrow<str>> Builder<S>
Sourcepub fn build_let(
&mut self,
let_statement: &Let<'a>,
) -> Result<SmallVec<[Definition<'a>; 1]>, BuilderError<'a>>
pub fn build_let( &mut self, let_statement: &Let<'a>, ) -> Result<SmallVec<[Definition<'a>; 1]>, BuilderError<'a>>
Build a let expression, registering the symbols defined in the current scope Returns a list of symbols defined
Sourcepub fn assign_pattern(
&mut self,
pattern: &Pattern<'a>,
expr: &Expr<'a>,
) -> Result<SmallVec<[Definition<'a>; 1]>, BuilderError<'a>>
pub fn assign_pattern( &mut self, pattern: &Pattern<'a>, expr: &Expr<'a>, ) -> Result<SmallVec<[Definition<'a>; 1]>, BuilderError<'a>>
Assign an expression to a pattern Returns a list of symbols defined, along with previous definitions (if any)
Sourcepub fn build_simple_assign(
&mut self,
simple: &SimpleAssignment<'a>,
expr: &Expr<'a>,
) -> Result<Definition<'a>, BuilderError<'a>>
pub fn build_simple_assign( &mut self, simple: &SimpleAssignment<'a>, expr: &Expr<'a>, ) -> Result<Definition<'a>, BuilderError<'a>>
Build a simple assignment.
Sourcepub fn build_expr(&mut self, expr: &Expr<'a>) -> Result<ValId, BuilderError<'a>>
pub fn build_expr(&mut self, expr: &Expr<'a>) -> Result<ValId, BuilderError<'a>>
Build the value for an expression
Sourcepub fn build_scope(
&mut self,
scope: &Scope<'a>,
) -> Result<ValId, BuilderError<'a>>
pub fn build_scope( &mut self, scope: &Scope<'a>, ) -> Result<ValId, BuilderError<'a>>
Build the value for a scope
Sourcepub fn lookup_path(&self, path: &Path<'a>) -> Result<ValId, BuilderError<'a>>
pub fn lookup_path(&self, path: &Path<'a>) -> Result<ValId, BuilderError<'a>>
Look up a path
Sourcepub fn build_sexpr(
&mut self,
sexpr: &Sexpr<'a>,
) -> Result<ValId, BuilderError<'a>>
pub fn build_sexpr( &mut self, sexpr: &Sexpr<'a>, ) -> Result<ValId, BuilderError<'a>>
Build the value for an S-expression
Sourcepub fn build_sexpr_args(
&mut self,
sexpr: &Sexpr<'a>,
) -> Result<SexprArgs, BuilderError<'a>>
pub fn build_sexpr_args( &mut self, sexpr: &Sexpr<'a>, ) -> Result<SexprArgs, BuilderError<'a>>
Build the arguments for an S-expression
Trait Implementations§
Auto Trait Implementations§
impl<S> Freeze for Builder<S>
impl<S> !RefUnwindSafe for Builder<S>
impl<S> Send for Builder<S>where
S: Send,
impl<S> Sync for Builder<S>where
S: Sync,
impl<S> Unpin for Builder<S>where
S: Unpin,
impl<S> !UnwindSafe for Builder<S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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