Author: paultcochrane
Date: Sat Mar 31 02:53:06 2007
New Revision: 17878

Modified:
   trunk/t/codingstd/c_parens.t

Log:
[t/codingstd] Corrected issue whereby the string and comment removing code
caused the space-before-parenthesis test to fail on correct files.  
Patch courtesy of Sartak <sartak at gmail dot com>.


Modified: trunk/t/codingstd/c_parens.t
==============================================================================
--- trunk/t/codingstd/c_parens.t        (original)
+++ trunk/t/codingstd/c_parens.t        Sat Mar 31 02:53:06 2007
@@ -64,11 +64,11 @@
             $buf = <$fh>;
         }
         $buf =~ s{ (?:
-                       (?: ' (?: \\\\ | \\' | [^'] )* ' )  # remove ' string
-                     | (?: " (?: \\\\ | \\" | [^"] )* " )  # remove " string
-                     | /\* .*? \*/                         # remove C comment
+                       (?: (') (?: \\\\ | \\' | [^'] )* (') ) # remove ' string
+                     | (?: (") (?: \\\\ | \\" | [^"] )* (") ) # remove " string
+                     | /(\*) .*? (\*)/                        # remove C 
comment
                    )
-                }{}gsx;
+                }{defined $1 ? "$1$2" : defined $3 ? "$3$4" : "$5$6"}egsx;
 
         if ( $buf =~ m{ ( (?<!\w) (?:$keywords) (?: \( | \ \s+ \( ) ) }x ) {
             push @keyword_paren => "$path: $1\n";

Reply via email to