[Bps-public-commit] CSS-Squish branch, master, updated. v0.09-6-ge2a3aa3

Ruslan Zakirov ruz at bestpractical.com
Thu Sep 8 10:29:17 EDT 2011


The branch, master has been updated
       via  e2a3aa30ca231a0c32c3ef5907756f17ff3fc68f (commit)
       via  044516756b857da5875e0e3bd6eb680ddc20a882 (commit)
      from  0d09a4adcc0b1c3545e212798bd22f4851546c99 (commit)

Summary of changes:
 lib/CSS/Squish.pm     |    6 ++++--
 t/08-comments.t       |    4 +++-
 t/css/08-comments.css |    4 +++-
 3 files changed, 10 insertions(+), 4 deletions(-)

- Log -----------------------------------------------------------------
commit 044516756b857da5875e0e3bd6eb680ddc20a882
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu Sep 8 18:19:31 2011 +0400

    properly handle endless comments

diff --git a/lib/CSS/Squish.pm b/lib/CSS/Squish.pm
index fb26498..f54e86e 100644
--- a/lib/CSS/Squish.pm
+++ b/lib/CSS/Squish.pm
@@ -165,9 +165,10 @@ sub _concatenate_to {
                 $line .= $tmp;
                 next unless $line =~ s/^(\s*$COMMENT)//o;
 
-                print $dest $1; last;
+                print $dest $1; goto REDO;
             }
-            goto REDO;
+            # endless comment
+            print $dest $line; last;
         }
         elsif ( $line =~ /$AT_IMPORT/o ) {
             my $import = $1;
diff --git a/t/08-comments.t b/t/08-comments.t
index 0094f93..e4ca1e7 100644
--- a/t/08-comments.t
+++ b/t/08-comments.t
@@ -30,7 +30,9 @@ inside 01-basic-import.css
 
 /** End of 01-basic-import.css */
 
-body { color: blue; }
+
+/* endless
+ * bad comment
 
 EOT
 
diff --git a/t/css/08-comments.css b/t/css/08-comments.css
index bc40d51..be12dbe 100644
--- a/t/css/08-comments.css
+++ b/t/css/08-comments.css
@@ -13,5 +13,7 @@ comment */
  */
 
 @import "01-basic-import.css";
-body { color: blue; }
+
+/* endless
+ * bad comment
 

commit e2a3aa30ca231a0c32c3ef5907756f17ff3fc68f
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu Sep 8 18:29:00 2011 +0400

    comment regexp

diff --git a/lib/CSS/Squish.pm b/lib/CSS/Squish.pm
index f54e86e..d7c6a0c 100644
--- a/lib/CSS/Squish.pm
+++ b/lib/CSS/Squish.pm
@@ -80,6 +80,7 @@ my $AT_IMPORT = qr/^\s*                     # leading whitespace
                    \s*$                     # trailing whitespace
                   /x;
 
+# http://www.w3.org/TR/CSS21/grammar.html#scanner
 my $COMMENT = qr{/\*[^*]*\*+([^/*][^*]*\*+)*/}ms;
 
 =head1 COMMON METHODS

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list