diff options
| author | JSDurand <mmemmew@gmail.com> | 2026-10-16 18:16:36 +0800 |
|---|---|---|
| committer | JSDurand <mmemmew@gmail.com> | 2026-10-16 18:16:36 +0800 |
| commit | 918235659f7b0d80bfa305875ab7cc988cc51761 (patch) | |
| tree | ee657d85a6954a9d4327cc0d938e605cbb8637d1 /chain/src/atom/mod.rs | |
| parent | fba9a90cfc6aca2a26cce72f55fb261789139781 (diff) | |
partial commit, before trying the new guide by claudeattempt1
Diffstat (limited to 'chain/src/atom/mod.rs')
| -rw-r--r-- | chain/src/atom/mod.rs | 18 |
1 files changed, 18 insertions, 0 deletions
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<LabelType<TNT>> + Deref<Target = Grammar> { /// 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<bool, GrammarError>; + + /// 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; |
