summaryrefslogtreecommitdiff
path: root/pkgtools/pkglint
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2008-12-02 09:00:28 +0000
committerrillig <rillig@pkgsrc.org>2008-12-02 09:00:28 +0000
commitc881ac3cba5b47c83a18286853d637a0983a10b8 (patch)
tree10455858c3a74752bb087b6b173c05f59ea0a6a5 /pkgtools/pkglint
parent09d0afedeb7fef003abff6cc1e82b899d11d0dc0 (diff)
downloadpkgsrc-c881ac3cba5b47c83a18286853d637a0983a10b8.tar.gz
Removed unused code. Changed one constructor call to match the pattern
of all the others. Explained how to get an overview of the code.
Diffstat (limited to 'pkgtools/pkglint')
-rw-r--r--pkgtools/pkglint/files/pkglint.pl61
1 files changed, 5 insertions, 56 deletions
diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl
index f607bb96e0e..1be7ae76c36 100644
--- a/pkgtools/pkglint/files/pkglint.pl
+++ b/pkgtools/pkglint/files/pkglint.pl
@@ -1,5 +1,5 @@
#! @PERL@
-# $NetBSD: pkglint.pl,v 1.791 2008/11/30 22:19:01 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.792 2008/12/02 09:00:28 rillig Exp $
#
# pkglint - static analyzer and checker for pkgsrc packages
@@ -22,6 +22,9 @@
# All rights reserved.
# Freely redistributable. Absolutely no warranty.
+# To get an overview of the code, run:
+# sed -n -e 's,^\(sub .*\) {.*, \1,p' -e '/^package/p'
+
#==========================================================================
# Note: The @EXPORT clauses in the packages must be in a BEGIN block,
# because otherwise the names starting with an uppercase letter are not
@@ -274,60 +277,6 @@ sub set_show_source_flag() { $show_source_flag = true; }
#== End of PkgLint::Logging ===============================================
#==========================================================================
-# A File is a structure containing the contents of a file:
-# name: string The name of the file.
-# lines: array of string The physical lines in the file.
-#==========================================================================
-package PkgLint::File;
-
-use enum qw(NAME LINES);
-
-sub new($$$) {
- my ($class, $name, $lines) = @_;
- my $self = [$name, $lines];
- bless($self, $class);
- return $self;
-}
-
-sub name($) { return shift(@_)->[NAME]; }
-sub lines($) { return shift(@_)->[LINES]; }
-
-sub load($$) {
- my ($self, $fname) = @_;
- my ($lines);
-
- $lines = [];
- open(F, "<", $fname) or return undef;
- while (defined(my $line = <F>)) {
- push(@{$lines}, $line);
- }
- close(F) or return undef;
-
- $self->[NAME] = $fname;
- $self->[LINES] = $lines;
- return $self;
-}
-
-#==========================================================================
-# A Location is a structure containing a location in a file:
-# lineno: int The line number in the file
-# colno: int The column number in the file
-#==========================================================================
-package PkgLint::Location;
-
-use enum qw(LINENO COLNO);
-
-sub new($$$$) {
- my ($class, $lineno, $colno) = @_;
- my ($self) = ([$lineno, $colno]);
- bless($self, $class);
- return $self;
-}
-
-sub lineno($) { return shift(@_)->[LINENO]; }
-sub colno($) { return shift(@_)->[COLNO]; }
-
-#==========================================================================
# A SimpleMatch is the result of applying a regular expression to a Perl
# scalar value. It can return the range and the text of the captured
# groups.
@@ -2871,7 +2820,7 @@ sub expect($$$) {
if ($lineno <= $#{$lines} && $lines->[$lineno]->text =~ $regex) {
${$lineno_ref}++;
- return new PkgLint::SimpleMatch($lines->[$lineno]->text, \@-, \@+);
+ return PkgLint::SimpleMatch->new($lines->[$lineno]->text, \@-, \@+);
} else {
return false;
}