diff options
| author | Paul Buetow <paul@buetow.org> | 2008-05-26 19:15:55 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2008-05-26 19:15:55 +0000 |
| commit | d90c63eb9cff4463f199ed50bdc183ec79a436d8 (patch) | |
| tree | 9b38b1ebaa463497ee31196f76ff8b7a566fc37a | |
| parent | 7271eb78953936da045fd4ac8676e6d53d33370b (diff) | |
not needed
| -rw-r--r-- | scripts/sortmethods.pl | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/scripts/sortmethods.pl b/scripts/sortmethods.pl deleted file mode 100644 index 3ee19b1..0000000 --- a/scripts/sortmethods.pl +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/perl - -# Automatically sorts the functions of a java class alphanumerical -# (C) 2008 by Paul C. Buetow - -use strict; -use warnings; - -use File::Find; -use re 'eval'; - -my @files; - -sub usage () { - return "Usage: perl $0 <sourcedir>\n"; -} - -sub process ($$) { - my %class; - my $indent; - - $_[1] =~ - m< - (?{ print "Start parsing $_[0]\n" }) - (package .*?;\n) (?{ - print "Found package: $1"; - $class{package} = $1; - }) - (?: - .*? - (import .*?;\n) (?{ - print "Found import: $2"; - push @{$class{imports}}, $2; - }) - )+ - .*? - ((?:(?:class)|(?:interface)) .*?) {\n+ (?{ - print "Sorting imports\n"; - @{$class{imports}} = sort @{$class{imports}}; - print "Found class prototype: $3"; - $class{prototype} = $3; - }) - (?= - (\s+) (?{ - $indent = length $4; - print "Class indent is " . $indent . "\n"; - }) - ) - (?: - \n?(??{'\s' x $indent}) - (.+?{.*? \n(??{'\s' x $indent}) }) (?{ - print "Found [[$5]]"; - }) - )* - >xs; - (); -} - -find(sub { push @files, $File::Find::name if /\.java$/ }, shift || die usage); - -for (@files) { - open my $file, $_ or die "$!: $_\n"; - print process $_, join '', <$file>; - close $file; -} - |
