rev 13533 - in people/modax/copyright-helper/trunk: . parsers

Modestas Vainius modax-guest at alioth.debian.org
Sun Jan 25 14:19:06 UTC 2009


Author: modax-guest
Date: 2009-01-25 14:19:05 +0000 (Sun, 25 Jan 2009)
New Revision: 13533

Modified:
   people/modax/copyright-helper/trunk/CHParsers.pm
   people/modax/copyright-helper/trunk/copyright-helper.pl
   people/modax/copyright-helper/trunk/parsers/c_cpp.pm
Log:
More smart filename parser. Supports all sorts of extension variations

Modified: people/modax/copyright-helper/trunk/CHParsers.pm
===================================================================
--- people/modax/copyright-helper/trunk/CHParsers.pm	2009-01-25 13:41:48 UTC (rev 13532)
+++ people/modax/copyright-helper/trunk/CHParsers.pm	2009-01-25 14:19:05 UTC (rev 13533)
@@ -114,16 +114,18 @@
     our %parsers;
     my ($file, $fh) = @_;
 
-    my $ext = $& if ($file =~ /[^.]*$/);
-    if (exists $parsers{$ext}) {
-        for my $parser (@{$parsers{$ext}}) {
-            if (my $arg = $parser->prepare($file, $fh)) {
-                return ($parser, $arg);
+    my @filename = split(/\./, $file);
+    for (; scalar(@filename); shift @filename) {
+        my $ext = join(".", @filename);
+        if (exists $parsers{$ext}) {
+            for my $parser (@{$parsers{$ext}}) {
+                if (my $arg = $parser->prepare($file, $fh)) {
+                    return ($parser, $arg);
+                }
             }
         }
-    } else {
-        return (0, 0);
     }
+    return (0, 0);
 }
 
 sub get_filelist($) {

Modified: people/modax/copyright-helper/trunk/copyright-helper.pl
===================================================================
--- people/modax/copyright-helper/trunk/copyright-helper.pl	2009-01-25 13:41:48 UTC (rev 13532)
+++ people/modax/copyright-helper/trunk/copyright-helper.pl	2009-01-25 14:19:05 UTC (rev 13533)
@@ -221,7 +221,7 @@
 }
 
 # Entry point
-${main::VERSION}='0.5.0';
+${main::VERSION}='0.5.1';
 print_msg "\n";
 print_msg "Copyright Helper v${main::VERSION}\n";
 print_msg "Extracts copyright and license information from source code\n\n";

Modified: people/modax/copyright-helper/trunk/parsers/c_cpp.pm
===================================================================
--- people/modax/copyright-helper/trunk/parsers/c_cpp.pm	2009-01-25 13:41:48 UTC (rev 13532)
+++ people/modax/copyright-helper/trunk/parsers/c_cpp.pm	2009-01-25 14:19:05 UTC (rev 13533)
@@ -116,5 +116,5 @@
 }
 
 sub extensions {
-    return qw( c cpp cxx h cc java js idl );
+    return qw( c cpp cxx h cc java js idl h.cmake );
 }




More information about the pkg-kde-commits mailing list