pub struct MatchIR {
pub label: Label,
pub nav: Nav,
pub node_type: NodeTypeIR,
pub node_field: Option<NonZeroU16>,
pub pre_effects: Vec<EffectIR>,
pub neg_fields: Vec<u16>,
pub post_effects: Vec<EffectIR>,
pub predicate: Option<PredicateIR>,
pub successors: Vec<Label>,
}Expand description
Match instruction IR with symbolic successors.
Fields§
§label: LabelWhere this instruction lives.
Navigation command. Epsilon means pure control flow (no node check).
node_type: NodeTypeIRNode type constraint (Any = wildcard, Named/Anonymous for specific checks).
node_field: Option<NonZeroU16>Field constraint (None = wildcard).
pre_effects: Vec<EffectIR>Effects to execute before match attempt.
neg_fields: Vec<u16>Fields that must NOT be present on the node.
post_effects: Vec<EffectIR>Effects to execute after successful match.
predicate: Option<PredicateIR>Predicate for node text filtering (None = no text check).
successors: Vec<Label>Successor labels (empty = accept, 1 = linear, 2+ = branch).
Implementations§
Source§impl MatchIR
impl MatchIR
Sourcepub fn epsilon(label: Label, next: Label) -> Self
pub fn epsilon(label: Label, next: Label) -> Self
Create an epsilon transition (no node interaction) to a single successor.
Set the navigation command.
Sourcepub fn node_type(self, t: NodeTypeIR) -> Self
pub fn node_type(self, t: NodeTypeIR) -> Self
Set the node type constraint.
Sourcepub fn node_field(self, f: impl Into<Option<NonZeroU16>>) -> Self
pub fn node_field(self, f: impl Into<Option<NonZeroU16>>) -> Self
Set the field constraint.
Sourcepub fn pre_effect(self, e: EffectIR) -> Self
pub fn pre_effect(self, e: EffectIR) -> Self
Add a pre-match effect.
Sourcepub fn post_effect(self, e: EffectIR) -> Self
pub fn post_effect(self, e: EffectIR) -> Self
Add a post-match effect.
Sourcepub fn neg_fields(self, fields: impl IntoIterator<Item = u16>) -> Self
pub fn neg_fields(self, fields: impl IntoIterator<Item = u16>) -> Self
Add multiple negated field constraints.
Sourcepub fn pre_effects(self, effects: impl IntoIterator<Item = EffectIR>) -> Self
pub fn pre_effects(self, effects: impl IntoIterator<Item = EffectIR>) -> Self
Add multiple pre-match effects.
Sourcepub fn post_effects(self, effects: impl IntoIterator<Item = EffectIR>) -> Self
pub fn post_effects(self, effects: impl IntoIterator<Item = EffectIR>) -> Self
Add multiple post-match effects.
Sourcepub fn predicate(self, p: PredicateIR) -> Self
pub fn predicate(self, p: PredicateIR) -> Self
Set the predicate for node text filtering.
Sourcepub fn resolve<F, G, R>(
&self,
map: &BTreeMap<Label, StepAddr>,
lookup_member: F,
get_member_base: G,
lookup_regex: R,
) -> Vec<u8> ⓘ
pub fn resolve<F, G, R>( &self, map: &BTreeMap<Label, StepAddr>, lookup_member: F, get_member_base: G, lookup_regex: R, ) -> Vec<u8> ⓘ
Resolve labels and serialize to bytecode bytes.
lookup_member: maps (field_name Symbol, field_type TypeId) to member indexget_member_base: maps parent TypeId to member base indexlookup_regex: maps pattern to RegexTable index (for predicate regexes)
Sourcepub fn is_epsilon(&self) -> bool
pub fn is_epsilon(&self) -> bool
Check if this is an epsilon transition (no node interaction).