Skip to content

Commit 962a9c8

Browse files
committed
refactor(lower): use nullable pattern vocabulary
1 parent 6795c71 commit 962a9c8

2 files changed

Lines changed: 2 additions & 9 deletions

File tree

‎crates/plotnik-lib/src/compiler/lower/thompson/patterns.rs‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -439,13 +439,6 @@ impl NfaBuilder<'_> {
439439
self.ctx.analysis.pattern_facts.pattern_is_nullable(pattern)
440440
}
441441

442-
/// A sequence item that may consume nothing: a skippable quantifier, a
443-
/// reference to a nullable definition, a group of such items, or an
444-
/// alternation with a nullable alternative.
445-
pub(super) fn is_skippable_item(&self, pattern: &Pattern) -> bool {
446-
self.pattern_is_nullable(pattern)
447-
}
448-
449442
/// [`pattern_owns_iteration`] extended to nullable references: the inlined
450443
/// body stands in for the item, so iteration ownership is the body's — a
451444
/// quantifier-rooted body owns its sibling search, and wrapping it in a

‎crates/plotnik-lib/src/compiler/lower/thompson/sequences.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ impl NfaBuilder<'_> {
187187
let first_is_skippable = nav_modes
188188
.first()
189189
.and_then(|(idx, _)| items[*idx].as_pattern())
190-
.is_some_and(|p| self.is_skippable_item(p));
190+
.is_some_and(|p| self.pattern_is_nullable(p));
191191
// The skip path makes the follower the new "first" item, so it must re-derive
192192
// first-position navigation rather than the sibling `Next` the match path uses.
193193
// This is required whenever the first item navigates to a position (`Down*` into
@@ -225,7 +225,7 @@ impl NfaBuilder<'_> {
225225
let last_is_skippable = nav_modes
226226
.last()
227227
.and_then(|(idx, _)| items[*idx].as_pattern())
228-
.is_some_and(|p| self.is_skippable_item(p));
228+
.is_some_and(|p| self.pattern_is_nullable(p));
229229

230230
// Build chain in reverse: last pattern exits to `exit`, each prior exits to next.
231231
let mut current_exit = exit;

0 commit comments

Comments
 (0)