From 918235659f7b0d80bfa305875ab7cc988cc51761 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Fri, 16 Oct 2026 18:16:36 +0800 Subject: partial commit, before trying the new guide by claude --- chain/src/atom/mod.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'chain/src/atom/mod.rs') diff --git a/chain/src/atom/mod.rs b/chain/src/atom/mod.rs index 4b3bfce..1fdbbd1 100644 --- a/chain/src/atom/mod.rs +++ b/chain/src/atom/mod.rs @@ -35,6 +35,24 @@ pub trait Atom: Nfa> + Deref { /// Return the bound for `is_accepting`. fn accepting_len(&self) -> usize; + + /// Tell whether a node is accepting inside a frame of the + /// non-terminal `frame_nt`, that is to say, whether reaching the + /// node completes `frame_nt`. + /// + /// For a rule position this is not the same as `is_accepting`, + /// since the states are shared by all non-terminals. For other + /// nodes, virtual nodes included, it is the same. + fn is_accepting_in(&self, frame_nt: usize, node_id: usize) -> Result; + + /// Tell whether, inside a frame of the non-terminal `frame_nt`, + /// we are allowed to move into the node `node_id`. + /// + /// The states of the automaton are shared by all non-terminals, + /// so a rule position is allowed only if the non-terminal owning + /// it is a left corner of `frame_nt`. Other nodes are always + /// allowed. + fn allowed_in_frame(&self, frame_nt: usize, node_id: usize) -> bool; } pub mod default; -- cgit v1.2.3-18-g5258