[gtk-doc] common: drop empty lines when stripping comments



commit 9e53b98affd26d8b87a9199b57e46c58766bcf43
Author: Stefan Kost <ensonic users sf net>
Date:   Sun May 1 21:40:23 2011 +0300

    common: drop empty lines when stripping comments
    
    When removing comments in structs/enums/unions drop the whole line if there
    would only be whitespace left.

 gtkdoc-common.pl.in |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/gtkdoc-common.pl.in b/gtkdoc-common.pl.in
index 6613a9c..c128b21 100644
--- a/gtkdoc-common.pl.in
+++ b/gtkdoc-common.pl.in
@@ -115,7 +115,9 @@ sub ParseStructDeclaration {
     $declaration =~ s!\n?[ \t]*/\*\s*<\s*(private|protected)\s*>\s*\*/.*?(?:/\*\s*<\s*public\s*>\s*\*/|(?=^\}))!!msgx;
 
     # Remove all other comments;
+    $declaration =~ s \n\s*/\*([^*]+|\*(?!/))*\*/\s*\n \n@msg;
     $declaration =~ s@/\*([^*]+|\*(?!/))*\*/@ @g;
+    $declaration =~ s \n\s*// *\n \n@msg;
     $declaration =~ s@//.*@@g;
 
     my @result = ();
@@ -257,9 +259,11 @@ sub ParseEnumDeclaration {
     # Assume end of declaration if line begins with '}'
     $declaration =~ s!\n?[ \t]*/\*\s*<\s*(private|protected)\s*>\s*\*/.*?(?:/\*\s*<\s*public\s*>\s*\*/|(?=^\}))!!msgx;
 
-    # Remove comments
+    # Remove all other comments;
+    $declaration =~ s \n\s*/\*([^*]+|\*(?!/))*\*/\s*\n \n@msg;
     $declaration =~ s@/\*([^*]+|\*(?!/))*\*/@ @g;
-    $declaration =~ s@//.*$@@g;
+    $declaration =~ s \n\s*// *\n \n@msg;
+    $declaration =~ s@//.*@@g;
 
     my @result = ();
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]