package DX::Deparse;
use Scalar::Util qw(blessed);
+use curry;
use DX::Class;
sub indent_by { ' ' }
sub with_one_step {
my ($self) = @_;
return undef unless my $step = $self->next_step;
- trace step => $step;
+ #trace step => $step;
return $step->apply_to($self);
}
return unless $self->trace_these->{$part};
my $dp = deparse($thing);
$dp =~ s/\n$//;
- warn "${tag}: ${dp}\n";
+ warn "${dp}\n";
}
}
sub apply_to {
my ($self, $ss) = @_;
+ trace backtrack => [ statement => [ [ symbol => 'backtrack' ] ] ];
foreach my $adj (@{$ss->adjustments_made}) {
my ($step_was, $ss_was) = @$adj;
if (my $alt = $step_was->alternative_step) {
sub apply_to {
my ($self, $ss) = @_;
+ trace recheck => [ statement => [ [ symbol => 'complete_recheck' ] ] ];
+
my $prop = $self->was_recheck_for;
my $re_ss = $self->resume_search_state;
my $re_hyp = $re_ss->current_hypothesis;
sub apply_to {
my ($self, $ss) = @_;
my $hyp = $ss->current_hypothesis;
+ trace consider => [
+ statement => [
+ [ symbol => 'consider' ],
+ @{$self->proposition->for_deparse->[1]},
+ ],
+ ];
if (my $step = $self->proposition->resolve_for($hyp->scope)) {
return $ss->but(next_step => $step);
}
my ($prop, @rest) = @{$self->proposition_list};
+ trace recheck => [ statement => [
+ [ symbol => 'recheck' ],
+ @{$prop->for_deparse->[1]},
+ ] ];
+
my $old_hyp = $old_ss->current_hypothesis;
# we should probably be doing something about pruning the scope
sub apply_to {
my ($self, $old_ss) = @_;
+ trace recheck => [ statement => [ [ symbol => 'fail_recheck' ] ] ];
return $self->resume_search_state;
}
sub apply_to {
my ($self, $old_ss) = @_;
+ trace resolve => [ statement => [
+ [ symbol => 'resolve' ],
+ [ block => [
+ [ statement => [
+ [ symbol => 'proposition' ],
+ @{$self->resolves->for_deparse->[1]},
+ ] ],
+ (@{$self->actions}
+ ? [ statement => [
+ [ symbol => 'actions' ],
+ [ block => [ @{$self->actions} ] ],
+ ] ]
+ : ()),
+ ] ]
+ ] ];
my $ns = do {
if (my $prop = $old_ss->next_proposition) {
DX::Step::ConsiderProposition->new(