map [ $_, $dict->get_member_at($_) ], $dict->index_list
], $meta);
return '{{ }}' unless $chunks =~ /\S/;
+ s/^\s+//, s/\n\s+/ /g for (my $maybe = $chunks);
+ return "{{ ${maybe} }}" if length($maybe) < $meta->{width_left};
"{{\n${chunks}\n}}";
}
my ($self, $pairs, $meta) = @_;
my $chunks = $self->_fmt_pairs($pairs, $meta);
return '{ }' unless $chunks =~ /\S/;
+ s/^\s+//, s/\n\s+/ /g for (my $maybe = $chunks);
+ return "{ ${maybe} }" if length($maybe) < $meta->{width_left};
"{\n${chunks}\n}"
}
my ($self, $hyp, $meta) = @_;
$self->_fmt_object([
map [ $_ => $hyp->$_ ],
- qw(actions outstanding_propositions resolved_propositions scope)
+ qw(actions resolved_propositions scope)
], $meta);
}
$self->_fmt_action_generic(AddValue => $action, $meta);
}
+sub _fmt_action_bindvalue {
+ my ($self, $action, $meta) = @_;
+ my $path = join '.', map $self->_fmt($_, $meta), @{$action->target_path};
+ my $bound_path = join '.',
+ map $self->_fmt($_, $meta),
+ @{$action->new_value
+ ->action_builder
+ ->inner_action_builder
+ ->target_path};
+ join ' ', BindValue => $path, $bound_path;
+}
+
+sub _fmt_action_addboundvalue {
+ my ($self, $action, $meta) = @_;
+ $self->_fmt_action_generic(AddBoundValue => $action, $meta);
+}
+
+sub _fmt_action_setboundvalue {
+ my ($self, $action, $meta) = @_;
+ $self->_fmt_action_generic(SetBoundValue => $action, $meta);
+}
+
sub _fmt_action_generic {
my ($self, $name, $action, $meta) = @_;
my $path = join '.', map $self->_fmt($_, $meta), @{$action->target_path};
my ($self, $rps, $meta) = @_;
$self->_fmt_object([
map {
- [ $_, $rps->dependencies_for($_) ]
+ [ $_, [
+ map bless([ @$_ ], 'DX::Dependency'),
+ map @{$_}[1..$#$_],
+ @{$rps->dependencies_for($_)}
+ ] ]
} @{$rps->propositions},
], $meta);
}
+sub _fmt_dependency {
+ my ($self, $dep, $meta) = @_;
+ '{ '.join(' ', map $self->_fmt($_, $meta), @$dep).' }'
+}
+
sub _fmt_proposition {
my ($self, $prop, $meta) = @_;
join ' ',
$prop->predicate,
- map $self->_fmt($_, $meta), @{$prop->args};
+ map $self->_fmt($_, $meta),
+ map +((!ref($_) and $prop->introduced_names->{$_}) ? "?$_" : $_),
+ @{$prop->args};
}
sub _fmt_scope {
], $meta);
}
+sub _fmt_step_considerproposition {
+ my ($self, $step, $meta) = @_;
+ 'consider '.$self->_fmt($step->proposition, $meta);
+}
+
+sub _fmt_step_resolveproposition {
+ my ($self, $step, $meta) = @_;
+ 'resolve '.$self->_fmt_object([
+ [ actions => $step->actions ],
+ ($step->alternative_step
+ ? [ alternative_step => '...' ]
+ : ()),
+ [ depends_on => [
+ map bless([ @$_ ], 'DX::Dependency'),
+ map @{$_}[1..$#$_],
+ @{$step->depends_on}
+ ] ],
+ ], $meta);
+}
+
+sub _fmt_step_backtrack { 'backtrack' }
+
+sub _fmt_step_markassolution { 'mark as solution' }
+
+sub _fmt_step_enterrecheck {
+ my ($self, $step, $meta) = @_;
+ 'recheck '.$self->_fmt($step->proposition_list->[0], $meta);
+}
+
+sub _fmt_step_completerecheck { 'complete recheck' }
+
+sub _fmt_step_failrecheck { 'fail recheck' }
+
1;