From a357d8a1bf904d8b100fe884dee38462c96a0d39 Mon Sep 17 00:00:00 2001 From: Sergei Zharinov Date: Thu, 15 Jan 2026 13:30:59 -0300 Subject: [PATCH] refactor: Remove `NavKind` wrapper, use `Nav` directly in fingerprinting --- crates/plotnik-bytecode/src/bytecode/nav.rs | 2 +- crates/plotnik-compiler/src/compile/verify.rs | 42 +------------------ 2 files changed, 3 insertions(+), 41 deletions(-) diff --git a/crates/plotnik-bytecode/src/bytecode/nav.rs b/crates/plotnik-bytecode/src/bytecode/nav.rs index 8845a25..df1893a 100644 --- a/crates/plotnik-bytecode/src/bytecode/nav.rs +++ b/crates/plotnik-bytecode/src/bytecode/nav.rs @@ -3,7 +3,7 @@ //! Navigation determines how the VM moves through the tree-sitter AST. /// Navigation command for VM execution. -#[derive(Clone, Copy, PartialEq, Eq, Debug, Default)] +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug, Default)] pub enum Nav { /// Epsilon transition: pure control flow, no cursor movement or node check. /// Used for branching, quantifier loops, and effect-only transitions. diff --git a/crates/plotnik-compiler/src/compile/verify.rs b/crates/plotnik-compiler/src/compile/verify.rs index 79fa7d1..81330fc 100644 --- a/crates/plotnik-compiler/src/compile/verify.rs +++ b/crates/plotnik-compiler/src/compile/verify.rs @@ -23,7 +23,7 @@ use super::compiler::CompileCtx; #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)] pub enum SemanticOp { /// Navigation (non-epsilon only, full detail preserved). - Nav(NavKind), + Nav(Nav), /// Named node match with optional type name. MatchNamed(Option), @@ -58,44 +58,6 @@ pub enum SemanticOp { CycleMarker(usize), } -/// Navigation kind for fingerprinting. -/// -/// Preserves full detail including Skip/Exact variants since these are semantically -/// significant (determined by anchors). -#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] -pub enum NavKind { - Stay, - StayExact, - Next, - NextSkip, - NextExact, - Down, - DownSkip, - DownExact, - Up(u8), - UpSkipTrivia(u8), - UpExact(u8), -} - -impl From