|
From: notifies s. of c. c. <per...@li...> - 2007-02-23 03:28:45
|
Revision: 103
http://svn.sourceforge.net/perl-flat/?rev=103&view=rev
Author: estrabd
Date: 2007-02-22 19:28:40 -0800 (Thu, 22 Feb 2007)
Log Message:
-----------
added a fix for recursive anonymous subroutine via Sub::Recursive
Modified Paths:
--------------
trunk/perl-flat/Makefile.PL
trunk/perl-flat/dev-scripts/bdetest.pl
trunk/perl-flat/lib/FLAT/DFA.pm
Modified: trunk/perl-flat/Makefile.PL
===================================================================
--- trunk/perl-flat/Makefile.PL 2007-02-22 22:27:12 UTC (rev 102)
+++ trunk/perl-flat/Makefile.PL 2007-02-23 03:28:40 UTC (rev 103)
@@ -5,7 +5,8 @@
WriteMakefile(
NAME => 'FLAT',
VERSION_FROM => 'lib/FLAT.pm',
- PREREQ_PM => { Parse::RecDescent => 0 },
+ PREREQ_PM => { Parse::RecDescent => 0,
+ Sub::Recursive => 0 },
PL_FILES => {'bin/util-put.pl', 'bin/util-put'},
($] >= 5.005 ? (ABSTRACT_FROM => 'lib/FLAT.pm',
AUTHOR => 'perl-flat')
Modified: trunk/perl-flat/dev-scripts/bdetest.pl
===================================================================
--- trunk/perl-flat/dev-scripts/bdetest.pl 2007-02-22 22:27:12 UTC (rev 102)
+++ trunk/perl-flat/dev-scripts/bdetest.pl 2007-02-23 03:28:40 UTC (rev 103)
@@ -15,4 +15,4 @@
#print Dumper($dfa->as_node_list);
my $tree = $dfa->as_depth_first_tree();
-print Dumper($tree);
+#print Dumper($tree);
Modified: trunk/perl-flat/lib/FLAT/DFA.pm
===================================================================
--- trunk/perl-flat/lib/FLAT/DFA.pm 2007-02-22 22:27:12 UTC (rev 102)
+++ trunk/perl-flat/lib/FLAT/DFA.pm 2007-02-23 03:28:40 UTC (rev 103)
@@ -177,6 +177,7 @@
# returns a tree stucture resulting from a dft of the DFA;
sub as_depth_first_tree {
+ use Sub::Recursive;
my $self = shift;
# data structure to do dft over
my %nodes = $self->as_node_list();
@@ -185,12 +186,12 @@
my %low = (); # "global" lookup table for low
my $lastDFLabel = 0;
my $recurse_level = 0; # tracks recurse level
- my $search = sub { };
- $search = sub {
+ my $search = recursive {
my $startNode = shift;
my %treeNode; # initialize
$recurse_level++; # <- tracker
if (!exists($dflabel{$startNode})) {
+ print "Accepting Node $startNode Found" if ($self->is_accepting($startNode));
$dflabel{$startNode} = ++$lastDFLabel; # the order inwhich this link was explored
$low{$startNode} = $lastDFLabel;
$backtracked{$startNode} = 0; # marks this node as visited before - for cross edge detection
@@ -213,7 +214,7 @@
} elsif ($dflabel{$adjacent} < $dflabel{$startNode}) { # back edge
# print "back edge, 2nd visit!\n";
}
- my $child = $search->($adjacent);
+ my $child = $REC->($adjacent);
if (defined($child)) {
$child->{right} = undef;
$child->{left} = undef;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|