pub struct EvalSite<'a> { /* private fields */ }Expand description
The site an evaluator is called from: the rule the reduction belongs to
and the live parse context, and neither when evaluation is called on
a finished tree.
The rule is a snapshot rather than the live rule, because the canonical
port hands the evaluator the PARENT of the rule that is closing, which
this engine exposes as a snapshot. Its state, its u flags and its node
cell are all reachable through it.
Implementations§
Source§impl<'a> EvalSite<'a>
impl<'a> EvalSite<'a>
Sourcepub fn new(rule: Option<Rc<RuleSnapshot>>, context: &'a mut Context) -> Self
pub fn new(rule: Option<Rc<RuleSnapshot>>, context: &'a mut Context) -> Self
A site inside a parse.
Sourcepub fn rule(&self) -> Option<&RuleSnapshot>
pub fn rule(&self) -> Option<&RuleSnapshot>
The rule the reduction belongs to, when there is one.
Sourcepub fn token(&self) -> Option<&Token>
pub fn token(&self) -> Option<&Token>
The token this OCCURRENCE of the operator was matched from.
The Op an evaluator receives is the shared description, one per
entry in the operator table, so it cannot say which occurrence is
being reduced. The canonical makeOp attaches the token to its
copy of the description for exactly that reason; this port keeps
the token beside the node instead, and hands it over here. The
position is the engine’s Site triple: token.site.pos, .ri
(row) and .ci (column).
It is None when the node was built without one, which is what
prattify called directly produces.