cvsuser 04/11/24 19:00:30
Modified: languages/regex 01_basic.imc regex.pl
languages/regex/lib/Regex Driver.pm Grammar.pm Grammar.y
Log:
Minor fixes needed to get the 0[12]_*.imc examples working again.
Revision Changes Path
1.2 +5 -3 parrot/languages/regex/01_basic.imc
Index: 01_basic.imc
===================================================================
RCS file: /cvs/public/parrot/languages/regex/01_basic.imc,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- 01_basic.imc 18 Sep 2004 03:16:57 -0000 1.1
+++ 01_basic.imc 25 Nov 2004 03:00:26 -0000 1.2
@@ -20,7 +20,9 @@
match2:
regex2 = compile_regex("aa")
- match = regex2("aaaargh")
+ .local pmc stack
+ stack = new IntList
+ match = regex2(1, "aaaargh", 0, stack)
print "regex match \"aaaargh\" =~ /aa/: "
if match goto goodness2
@@ -51,11 +53,11 @@
match3:
match=regex2("blah")
print "regex match \"blah\" =~ /aa/: "
- if match goto goodness3
+ if match goto badness3
print "Failed (as it should)\n"
end
-goodness3:
+badness3:
print "succeeded?! (should not have)\n"
end
.end
1.14 +1 -0 parrot/languages/regex/regex.pl
Index: regex.pl
===================================================================
RCS file: /cvs/public/parrot/languages/regex/regex.pl,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- regex.pl 18 Nov 2004 06:55:56 -0000 1.13
+++ regex.pl 25 Nov 2004 03:00:26 -0000 1.14
@@ -49,6 +49,7 @@
$options{'no-tree-optimize'} = 1 if ! $tree_opt;
$options{'no-list-optimize'} = 1 if ! $list_opt;
$options{'DEBUG'} = 1 if $debug;
+$options{subname} = $subname if $subname;
if ($language eq 'pir') {
$options{module} = "Regex::CodeGen::IMCC";
1.2 +19 -0 parrot/languages/regex/lib/Regex/Driver.pm
Index: Driver.pm
===================================================================
RCS file: /cvs/public/parrot/languages/regex/lib/Regex/Driver.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Driver.pm 18 Nov 2004 06:55:57 -0000 1.1
+++ Driver.pm 25 Nov 2004 03:00:30 -0000 1.2
@@ -114,4 +114,23 @@
print $fh join("\n", @$instructions), "\n";
}
+sub output_footer {
+ my ($self, $fh) = @_;
+
+ my $subname = $self->{subname} || '_regex';
+ print $fh <<"END";
+.sub $subname
+ .param string rx_input
+
+ .local pmc rx_match
+ .local pmc rx_stack
+ rx_stack = new IntList
+ rx_match = _default(1, rx_input, 0, rx_stack)
+ .return (rx_match)
+ end
+.end
+END
+
+}
+
1;
1.11 +1 -1 parrot/languages/regex/lib/Regex/Grammar.pm
Index: Grammar.pm
===================================================================
RCS file: /cvs/public/parrot/languages/regex/lib/Regex/Grammar.pm,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Grammar.pm 21 Nov 2004 07:52:11 -0000 1.10
+++ Grammar.pm 25 Nov 2004 03:00:30 -0000 1.11
@@ -505,7 +505,7 @@
push @types, 'CHAR';
} elsif (/\d/) {
push @types, 'NUM';
- } elsif (/\w/) {
+ } elsif (/[\w\s]/) {
push @types, 'CHAR';
} else {
push @types, $_;
1.11 +1 -1 parrot/languages/regex/lib/Regex/Grammar.y
Index: Grammar.y
===================================================================
RCS file: /cvs/public/parrot/languages/regex/lib/Regex/Grammar.y,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Grammar.y 21 Nov 2004 07:52:11 -0000 1.10
+++ Grammar.y 25 Nov 2004 03:00:30 -0000 1.11
@@ -13,7 +13,7 @@
push @types, 'CHAR';
} elsif (/\d/) {
push @types, 'NUM';
- } elsif (/\w/) {
+ } elsif (/[\w\s]/) {
push @types, 'CHAR';
} else {
push @types, $_;