cvsuser 03/11/18 23:20:01
Modified: languages/regex/lib/Regex CodeGen.pm
Log:
Fix minor bugs in dbprint
Revision Changes Path
1.12 +9 -3 parrot/languages/regex/lib/Regex/CodeGen.pm
Index: CodeGen.pm
===================================================================
RCS file: /cvs/public/parrot/languages/regex/lib/Regex/CodeGen.pm,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -w -r1.11 -r1.12
--- CodeGen.pm 14 Sep 2003 20:15:49 -0000 1.11
+++ CodeGen.pm 19 Nov 2003 07:20:01 -0000 1.12
@@ -17,13 +17,19 @@
sub init_context {
}
+# Convert "x%<foo>y" to
+# print "x"
+# print foo
+# print "y"
+#
sub dbprint {
- my ($self, $ctx, $what) = @_;
+ my ($self, $what) = @_;
return () unless $self->{DEBUG};
- $what = "\$($ctx->{rx_pos}): $what";
+ my $ctx = $self->{ctx};
+ $what = "\%<$ctx->{rx_pos}>: $what";
my @ops;
- foreach my $part ($what =~ /(<\w+>|[^<]+)/g) {
+ foreach my $part ($what =~ /((?:\%\<[\<\>\w]+\>)|[^\%]+)/g) {
if ($part =~ /^\%/) {
push @ops, $self->output_print(substr($part, 2, -1));
} else {