You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2011/06/02 23:18:27 UTC

svn commit: r1130819 - /incubator/jena/Jena2/ARQ/trunk/apacheize

Author: andy
Date: Thu Jun  2 21:18:27 2011
New Revision: 1130819

URL: http://svn.apache.org/viewvc?rev=1130819&view=rev
Log:
Strip head and tail block comments

Modified:
    incubator/jena/Jena2/ARQ/trunk/apacheize

Modified: incubator/jena/Jena2/ARQ/trunk/apacheize
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/apacheize?rev=1130819&r1=1130818&r2=1130819&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/apacheize (original)
+++ incubator/jena/Jena2/ARQ/trunk/apacheize Thu Jun  2 21:18:27 2011
@@ -7,6 +7,9 @@
 &setExclude ;
 undef $/ ;
 
+$HTEXT="HEADER" ;
+$TTEXT="TRAILER" ;
+
 while(defined($file = shift @ARGV))
 {
     # Excludes
@@ -21,8 +24,10 @@ sub process
     binmode FILE ;
     $_ = <FILE> ;
     my $t = &clean($_) ;
+    print $HTEXT,"\n" ;
     print $t ;
-    print "\n" ;
+    print "\n" unless ( $t =~ /\n$/s ) ;
+    print $TTEXT,"\n" ;
 }
 
 ## head and tail
@@ -30,9 +35,16 @@ sub clean
 {
     my $text = @_[0] ;
     $text =~ s!^\s*/\*[^{}/]*\*/\s*!!s ;
-    # This removes all trailing comments, not just the last.
-    $text =~ s!\s*/\*[^{}]*\*/\s*$!!s ;
-    # No newline on end.
+##     # This removes all trailing comments, not just the last.
+##     $text =~ s!\s*/\*[^{}]*\*/\s*$!!s ;
+    $text =~ s!
+\s*               ## Whitespace
+/\*               ## Start of comment
+[^*]*\*+          ## Any non-* then 1-or-more *
+([^/][^*]*\*+)*   ## Repeats of not-/ then unit as above
+/                 ## Close / for the comment
+\s*$              ## Whitespace, end of file
+!!sx ;
     return $text ;
 }