better tracing in SearchState
Matt S Trout [Wed, 16 Mar 2016 14:41:07 +0000 (14:41 +0000)]
lib/DX/SearchState.pm

index c1aae18..4d81d48 100644 (file)
@@ -38,9 +38,11 @@ sub with_one_step {
           resume_step => undef,
         );
       }
+      trace 'search.backtrack.alt' => $alt_step;
       $step = $alt_step;
     }
     ($hyp, $step) = @{shift(@alt)||[]};
+    trace 'search.backtrack.rewind_to' => $step;
   }
   return undef;
 }
@@ -50,6 +52,7 @@ sub find_solution {
   while ($state and @{$state->current_hypothesis->outstanding_propositions}) {
     $state = $state->with_one_step;
   }
+  trace 'search.solution.hyp' => $state->current_hypothesis if $state;
   return $state;
 }
 
@@ -57,7 +60,7 @@ sub force_backtrack {
   my ($self) = @_;
   my ($first_alt, @rest_alt) = @{$self->alternatives};
   return undef unless $first_alt;
-  trace 'search.backtrack' => $first_alt->[0];
+  trace 'search.backtrack.forced' => $first_alt->[0];
   return ref($self)->new(
     current_hypothesis => $first_alt->[0],
     resume_step => $first_alt->[1],