[][src]Struct moore_vhdl::term::TermContext

pub struct TermContext<C, S, D> {
    pub ctx: C,
    pub scope: S,
    // some fields omitted
}

A context within which termification can occur.

Fields

ctx: C

The underlying scoreboard context.

scope: S

The scope within which the terms will resolve their names.

Implementations

impl<C, S, D> TermContext<C, S, D>[src]

pub fn fold<'t>(&self, term: Spanned<Term<'t>>) -> Spanned<Term<'t>>[src]

Perform term folding.

This is a post-processing step that should be applied to all terms once they are constructed. Folding applies transformations to the terms, e.g. changing Ident(Type|Subtype) to TypeMark, or gobbling up subtype constraints where appropriate.

impl<'a, C, S, D> TermContext<C, S, D> where
    Self: DefSpecificTermContext<'a, D>,
    Self: ScopeSpecificTermContext<'a, S, D>,
    C: DiagEmitter + Copy,
    S: Copy,
    D: Copy
[src]

pub fn termify_literal(
    &self,
    ast: Spanned<&Literal>
) -> Result<Spanned<Term<'a>>>
[src]

Map an AST literal to a term.

pub fn ensure_resolved<'t>(
    &self,
    term: Spanned<Term<'t>>
) -> Result<Spanned<Term<'t>>>
[src]

Make sure the term is not an unresolved name.

This function emits a diagnostic if the term is Term::Unresolved(..). It is non-recursive.

pub fn termify_compound_name(
    &self,
    ast: &CompoundName
) -> Result<Spanned<Term<'a>>>
[src]

Map an AST compound name to a term.

pub fn termify_name(
    &self,
    name: Spanned<ResolvableName>
) -> Result<Spanned<Term<'a>>>
[src]

Map a resolvable name to a term.

This function is the bottom of the pit. Names are resolved here and mapped to the corresponding term. Calling functions may then proceed to handle the term as they see fit, usually inspecting what exact kind the term is of.

pub fn termify_paren_elems(
    &self,
    elems: &ParenElems
) -> Result<Spanned<Term<'a>>>
[src]

Map multiple parenthesis elements to a term.

pub fn termify_subtype_ind(
    &self,
    subty: &SubtypeInd
) -> Result<Spanned<Term<'a>>>
[src]

Map an AST subtype indication to a term.

pub fn termify_expr(&self, ast: &Expr) -> Result<Spanned<Term<'a>>>[src]

Map an AST expression to a term.

impl<'sbc, 'lazy, 'sb, 'ast, 'ctx> TermContext<&'sbc ScoreContext<'lazy, 'sb, 'ast, 'ctx>, ScopeRef, Def> where
    'lazy: 'sbc,
    'sb: 'lazy,
    'ast: 'sb,
    'ctx: 'sb, 
[src]

pub fn new(
    ctx: &'sbc ScoreContext<'lazy, 'sb, 'ast, 'ctx>,
    scope: ScopeRef
) -> Self
[src]

Create a new termification context.

pub fn termify_latent_name(
    &self,
    name: LatentName<'ast>
) -> Result<Spanned<Term<'_>>>
[src]

Map a latent name to a term.

pub fn term_to_expr(&self, term: Spanned<Term<'_>>) -> Result<ExprRef>[src]

Map a term to an expression and schedule the necessary tasks.

pub fn term_to_expr_spanned(
    &self,
    term: Spanned<Term<'_>>
) -> Result<Spanned<ExprRef>>
[src]

Same as term_to_expr, but the result is spanned.

pub fn term_to_expr_raw(&self, term: Spanned<Term<'_>>) -> Result<Expr>[src]

Map a term to an expression.

pub fn term_to_type_mark(
    &self,
    term: Spanned<Term<'_>>
) -> Result<Spanned<TypeMarkRef>>
[src]

Map a term to a type mark.

pub fn fold_term_as_type<'t>(
    &self,
    term: Spanned<Term<'t>>
) -> Result<Spanned<Term<'t>>>
[src]

Perform term folding expecting to yield a type.

This is a pre-processing step on terms. It is applied as soon as it is clear that a certain term should yield a type, e.g. when mapping to a subtype indication. This function performs certain precedence swaps and combines terms into higher level ones, e.g. Term::SubtypeInd.

pub fn term_to_subtype_ind(
    &self,
    term: Spanned<Term<'_>>
) -> Result<Spanned<SubtypeInd>>
[src]

Map a term to a subtype indication.

pub fn term_to_resolution_indication(
    &self,
    term: Spanned<Term<'_>>
) -> Result<Spanned<()>>
[src]

Map a term to a resolution indication.

pub fn term_to_constraint(
    &self,
    term: Spanned<Term<'_>>
) -> Result<Spanned<Constraint>>
[src]

Map a term to a constraint.

pub fn term_to_array_constraint(
    &self,
    span: Span,
    terms: Vec<Spanned<Term<'_>>>,
    elem: Option<Spanned<Term<'_>>>
) -> Result<Spanned<ArrayConstraint>>
[src]

Map a term to an array constraint.

pub fn term_to_record_constraint(
    &self,
    span: Span,
    terms: Vec<Spanned<Term<'_>>>
) -> Result<Spanned<RecordConstraint>>
[src]

Map a term to a record constraint.

pub fn term_to_element_constraint(
    &self,
    term: Spanned<Term<'_>>
) -> Result<Spanned<ElementConstraint>>
[src]

Map a term to an element constraint.

pub fn term_to_discrete_range(
    &self,
    term: Spanned<Term<'_>>
) -> Result<Spanned<DiscreteRange>>
[src]

Map a term to a discrete range.

pub fn term_to_range(&self, term: Spanned<Term<'_>>) -> Result<Spanned<Range>>[src]

Map a term to a range.

pub fn term_to_ident(&self, term: Spanned<Term<'_>>) -> Result<Spanned<Def>>[src]

Map a term to a definition.

This works for terms that are actually identifiers.

pub fn term_to_label(&self, term: Spanned<Term<'_>>) -> Result<Spanned<StmtRef>>[src]

Map a term to a label.

Returns the statement the label refers to.

pub fn term_to_signal(
    &self,
    term: Spanned<Term<'_>>
) -> Result<Spanned<SignalRef>>
[src]

Map a term to a signal.

pub fn term_to_choice(&self, term: Spanned<Term<'_>>) -> Result<Spanned<Choice>>[src]

Map a term to a choice.

See IEEE 1076-2008 section 9.3.3.1. A choice can be a simple expression, a discrete range, an identifier, or the keyword others.

pub fn term_to_aggregate(
    &self,
    term: Spanned<Term<'_>>
) -> Result<Spanned<AggregateRef>>
[src]

Map a term to an aggregate.

See IEEE 1076-2008 section 9.3.3.1.

pub fn term_to_assoc_list(
    &self,
    term: Spanned<Term<'_>>
) -> Result<Spanned<AssocList>>
[src]

Map a term to an association list.

See IEEE 1076-2008 section 6.5.7.

pub fn term_to_assoc_actual(
    &self,
    term: Spanned<Term<'_>>
) -> Result<Spanned<AssocActual>>
[src]

Map a term to an association actual.

impl<'t> TermContext<AllocContext<'t>, &'t ScopeData<'t>, Def2<'t>>[src]

pub fn new2(ctx: AllocContext<'t>) -> Self[src]

Create a new termification context.

Trait Implementations

impl<'t, C: DiagEmitter, S> DefSpecificTermContext<'t, Def> for TermContext<C, S, Def>[src]

impl<'t, C: DiagEmitter, S> DefSpecificTermContext<'t, Def2<'t>> for TermContext<C, S, Def2<'t>>[src]

impl<C: DiagEmitter, S, D> DiagEmitter for TermContext<C, S, D>[src]

impl<'t> ScopeSpecificTermContext<'t, &'t ScopeData<'t>, Def2<'t>> for TermContext<AllocContext<'t>, &'t ScopeData<'t>, Def2<'t>>[src]

fn termify_name_in_scope(
    &self,
    name: Spanned<ResolvableName>,
    scope: &'t ScopeData<'t>
) -> Result<Spanned<Term<'t>>>
[src]

Map a resolvable name to a term, resolving it within a scope.

impl<'t, 'sbc, 'lazy, 'sb, 'ast, 'ctx> ScopeSpecificTermContext<'t, ScopeRef, Def> for TermContext<&'sbc ScoreContext<'lazy, 'sb, 'ast, 'ctx>, ScopeRef, Def> where
    'lazy: 'sbc,
    'sb: 'lazy,
    'ast: 'sb,
    'ctx: 'sb, 
[src]

fn termify_name_in_scope(
    &self,
    name: Spanned<ResolvableName>,
    scope: ScopeRef
) -> Result<Spanned<Term<'t>>>
[src]

Map a resolvable name to a term, resolving it within a scope.

Auto Trait Implementations

impl<C, S, D> RefUnwindSafe for TermContext<C, S, D> where
    C: RefUnwindSafe,
    D: RefUnwindSafe,
    S: RefUnwindSafe

impl<C, S, D> Send for TermContext<C, S, D> where
    C: Send,
    D: Send,
    S: Send

impl<C, S, D> Sync for TermContext<C, S, D> where
    C: Sync,
    D: Sync,
    S: Sync

impl<C, S, D> Unpin for TermContext<C, S, D> where
    C: Unpin,
    D: Unpin,
    S: Unpin

impl<C, S, D> UnwindSafe for TermContext<C, S, D> where
    C: UnwindSafe,
    D: UnwindSafe,
    S: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.