Struct moore_vhdl::term::TermContext [−][src]
pub struct TermContext<C, S, D> { pub ctx: C, pub scope: S, // some fields omitted }
Expand description
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
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,
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,
Map an AST literal to a term.
Make sure the term is not an unresolved name.
This function emits a diagnostic if the term is Term::Unresolved(..)
.
It is non-recursive.
Map an AST compound name to a term.
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.
Map multiple parenthesis elements to a term.
Map an AST subtype indication 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,
impl<'sbc, 'lazy, 'sb, 'ast, 'ctx> TermContext<&'sbc ScoreContext<'lazy, 'sb, 'ast, 'ctx>, ScopeRef, Def> where
'lazy: 'sbc,
'sb: 'lazy,
'ast: 'sb,
'ctx: 'sb,
Create a new termification context.
Map a latent name to a term.
Map a term to an expression and schedule the necessary tasks.
Same as term_to_expr
, but the result is spanned.
Map a term to an expression.
Map a term to a type mark.
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
.
Map a term to a subtype indication.
Map a term to a resolution indication.
Map a term to a constraint.
Map a term to an array constraint.
pub fn term_to_record_constraint(
&self,
span: Span,
terms: Vec<Spanned<Term<'_>>>
) -> Result<Spanned<RecordConstraint>>
pub fn term_to_record_constraint(
&self,
span: Span,
terms: Vec<Spanned<Term<'_>>>
) -> Result<Spanned<RecordConstraint>>
Map a term to a record constraint.
pub fn term_to_element_constraint(
&self,
term: Spanned<Term<'_>>
) -> Result<Spanned<ElementConstraint>>
pub fn term_to_element_constraint(
&self,
term: Spanned<Term<'_>>
) -> Result<Spanned<ElementConstraint>>
Map a term to an element constraint.
pub fn term_to_discrete_range(
&self,
term: Spanned<Term<'_>>
) -> Result<Spanned<DiscreteRange>>
pub fn term_to_discrete_range(
&self,
term: Spanned<Term<'_>>
) -> Result<Spanned<DiscreteRange>>
Map a term to a discrete range.
Map a term to a range.
Map a term to a definition.
This works for terms that are actually identifiers.
Map a term to a label.
Returns the statement the label refers to.
Map a term to a signal.
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
.
Map a term to an aggregate.
See IEEE 1076-2008 section 9.3.3.1.
Map a term to an association list.
See IEEE 1076-2008 section 6.5.7.
Map a term to an association actual.
Create a new termification context.
Trait Implementations
impl<'t, C: DiagEmitter, S> DefSpecificTermContext<'t, Def2<'t>> for TermContext<C, S, Def2<'t>>
impl<'t, C: DiagEmitter, S> DefSpecificTermContext<'t, Def2<'t>> for TermContext<C, S, Def2<'t>>
Emit a diagnostic message.
impl<'t> ScopeSpecificTermContext<'t, &'t ScopeData<'t>, Def2<'t>> for TermContext<AllocContext<'t>, &'t ScopeData<'t>, Def2<'t>>
impl<'t> ScopeSpecificTermContext<'t, &'t ScopeData<'t>, Def2<'t>> for TermContext<AllocContext<'t>, &'t ScopeData<'t>, Def2<'t>>
fn termify_name_in_scope(
&self,
name: Spanned<ResolvableName>,
scope: &'t ScopeData<'t>
) -> Result<Spanned<Term<'t>>>
fn termify_name_in_scope(
&self,
name: Spanned<ResolvableName>,
scope: &'t ScopeData<'t>
) -> Result<Spanned<Term<'t>>>
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,
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,
fn termify_name_in_scope(
&self,
name: Spanned<ResolvableName>,
scope: ScopeRef
) -> Result<Spanned<Term<'t>>>
fn termify_name_in_scope(
&self,
name: Spanned<ResolvableName>,
scope: ScopeRef
) -> Result<Spanned<Term<'t>>>
Map a resolvable name to a term, resolving it within a scope.