[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash devtools/lib/Gnash/Utils.pm ChangeLog
From: |
Ann Barcomb |
Subject: |
[Gnash-commit] gnash devtools/lib/Gnash/Utils.pm ChangeLog |
Date: |
Sun, 08 Apr 2007 14:32:11 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Ann Barcomb <ann> 07/04/08 14:32:10
Modified files:
devtools/lib/Gnash: Utils.pm
. : ChangeLog
Log message:
This commit fixes the bug in Utils.pm which was causing the line numbers
to be printed incorrectly. It was happening because when a comment or
quoted string was being stripped from the code, any newlines in it were
discarded. Now it will be replaced with the appropriate number of
newlines.
Also I switched to using Regexp::Common instead of rolling my own
checks.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/devtools/lib/Gnash/Utils.pm?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2813&r2=1.2814
Patches:
Index: devtools/lib/Gnash/Utils.pm
===================================================================
RCS file: /sources/gnash/gnash/devtools/lib/Gnash/Utils.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- devtools/lib/Gnash/Utils.pm 31 Jan 2007 02:54:59 -0000 1.1
+++ devtools/lib/Gnash/Utils.pm 8 Apr 2007 14:32:10 -0000 1.2
@@ -2,6 +2,8 @@
use strict;
use warnings;
+use Regexp::Common qw/comment delimited/;
+
use Exporter 'import';
our @EXPORT_OK = qw/
clean
@@ -15,39 +17,45 @@
return
clean_cpp_comment(
clean_c_comment(
- clean_single_quoted_string(
- clean_double_quoted_string(
+ clean_quoted_string(
$_[0]
)
)
- )
);
}
sub clean_cpp_comment {
my $string = shift;
- $string =~ s{ // .* }{}gx;
+ while ($string =~ /$RE{comment}{'C++'}{-keep}/) {
+ my $matched = $1;
+ (my $newlines = $matched) =~ s/[^\n]//;
+ $string =~ s/$RE{comment}{'C++'}/$newlines/;
+ }
return $string;
}
sub clean_c_comment {
my $string = shift;
- $string =~ s{ /\* .*? \*/ }{}gsx;
+ while ($string =~ /$RE{comment}{C}{-keep}/) {
+ my $matched = $1;
+ (my $newlines = $matched) =~ s/[^\n]//;
+ $string =~ s/$RE{comment}{C}/$newlines/;
+ }
return $string;
}
-sub clean_single_quoted_string {
+sub clean_quoted_string {
my $string = shift;
- $string =~ s{ (?: ' (?: \\\\ | \\' | [^'] )* ' ) }{}gsx;
- return $string;
-}
-sub clean_double_quoted_string {
- my $string = shift;
- $string =~ s{ (?: " (?: \\\\ | \\" | [^"] )* " ) }{}gsx;
+ while ($string =~ /$RE{delimited}{-delim=>q{"'}}{-keep}/) {
+ my $matched = $1;
+ (my $newlines = $matched) =~ s/[^\n]//;
+ $string =~ s/$RE{delimited}{-delim=>q{"'}}/$newlines/;
+ }
return $string;
}
+
1;
=pod
@@ -76,8 +84,8 @@
=item clean($source)
-This function calls C<clean_double_quoted_string>,
-C<clean_single_quoted_string>, C<clean_c_comment>, and C<clean_cpp_comment>
+This function calls C<clean_quoted_string>,
+C<clean_c_comment>, and C<clean_cpp_comment>
and returns a string. It expects to receive the entire contents of a source
file.
@@ -103,9 +111,9 @@
becomes:
return 1;
-=item clean_single_quoted_string($source)
+=item clean_quoted_string($source)
-This routine will remove single quoted strings. It expects to receive the
+This routine will remove quoted strings. It expects to receive the
entire source code and will return the modified code as a string. For
instance,
return 'hello world';
@@ -113,16 +121,6 @@
becomes
return ;
-=item clean_double_quoted_string($source)
-
-This routine will remove double quoted strings. It expects to receive the
-entire source code and will return the modified code as a string. For
-instance,
- return "hello world";
-
-becomes
- return ;
-
=back
=head1 AUTHORS
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2813
retrieving revision 1.2814
diff -u -b -r1.2813 -r1.2814
--- ChangeLog 8 Apr 2007 13:51:10 -0000 1.2813
+++ ChangeLog 8 Apr 2007 14:32:10 -0000 1.2814
@@ -2,6 +2,8 @@
* devtools/testsuite/c_casts.t: added this test at Bastiaan's
request.
+ * devtools/lib/Gnash/Utils.pm: fix bug which caused wrong line
+ numbers to be reported.
2007-04-08 Zou Lunkai <address@hidden>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash devtools/lib/Gnash/Utils.pm ChangeLog,
Ann Barcomb <=