show dependencies before backtracking
[scpubgit/DX.git] / lib / DX / Utils.pm
index b52119d..2bef078 100644 (file)
@@ -11,7 +11,7 @@ my @const = (
 our @EXPORT_OK = (
   @const,
   (my @builders = qw(rspace rstrat res string number dict proposition)),
-  'deparse', '*trace', 'expand_deps',
+  'deparse', '*trace', 'expand_deps', 'format_deps',
 );
 
 our %EXPORT_TAGS = (
@@ -56,6 +56,15 @@ sub expand_deps {
   [ map _expand_dep($_), @{$_[0]} ]
 }
 
+sub format_deps {
+  [ block => [
+      map [ statement => [
+        [ symbol => (split '::', ${$_->[0]})[-1] ],
+        [ value_path => [ @{$_}[1..$#$_] ] ]
+      ] ], @{$_[0]}
+  ] ]
+}
+
 sub rspace {
   require DX::ResolutionSpace;
   DX::ResolutionSpace->new(@_);