summaryrefslogtreecommitdiff
path: root/modules/Parser.pm
diff options
context:
space:
mode:
authorelliott_c <ocielliottc@users.noreply.github.com>2003-03-07 14:54:58 +0000
committerelliott_c <ocielliottc@users.noreply.github.com>2003-03-07 14:54:58 +0000
commitfbda800dc0071f43ed4b7a993a44e7ffbc5d7255 (patch)
tree5486105fe7928c9f5d50d944ad9319f74f8c59f9 /modules/Parser.pm
parent75ebf8cabf8c814b136d3997a37bfee3e826669b (diff)
downloadMPC-fbda800dc0071f43ed4b7a993a44e7ffbc5d7255.tar.gz
ChangeLogTag: Fri Mar 7 08:51:56 2003 Chad Elliott <elliott_c@ociweb.com>
Diffstat (limited to 'modules/Parser.pm')
-rw-r--r--modules/Parser.pm84
1 files changed, 18 insertions, 66 deletions
diff --git a/modules/Parser.pm b/modules/Parser.pm
index 342784c4..d281b2ef 100644
--- a/modules/Parser.pm
+++ b/modules/Parser.pm
@@ -13,15 +13,26 @@ package Parser;
use strict;
use FileHandle;
+use StringProcessor;
+
+use vars qw(@ISA);
+@ISA = qw(StringProcessor);
+
+# ************************************************************
+# Data Section
+# ************************************************************
+
+my($cwd) = Cwd::getcwd();
+
# ************************************************************
# Subroutine Section
# ************************************************************
sub new {
my($class) = shift;
- my($self) = bless {'line_number' => 0,
- 'cwd' => Cwd::getcwd(),
- }, $class;
+ my($self) = $class->SUPER::new();
+
+ $self->{'line_number'} = 0;
return $self;
}
@@ -32,10 +43,10 @@ sub cd {
my($status) = chdir($dir);
if ($status && $dir ne '.') {
if ($dir =~ /^\// || $dir =~ /^[A-Za-z]:/) {
- $self->{'cwd'} = $dir;
+ $cwd = $dir;
}
else {
- $self->{'cwd'} .= "/$dir";
+ $cwd .= "/$dir";
}
}
return $status;
@@ -43,8 +54,8 @@ sub cd {
sub getcwd {
- my($self) = shift;
- return $self->{'cwd'};
+ #my($self) = shift;
+ return $cwd;
}
@@ -61,27 +72,6 @@ sub strip_line {
}
-sub process_special {
- my($self) = shift;
- my($line) = shift;
- my($length) = length($line);
-
- for(my $i = 0; $i < $length; $i++) {
- my($ch) = substr($line, $i, 1);
- if ($ch eq "\\" && $i + 1 < $length) {
- substr($line, $i, 1) = '';
- $length--;
- }
- elsif ($ch eq '"') {
- substr($line, $i, 1) = '';
- $length--;
- $i--;
- }
- }
- return $line;
-}
-
-
sub collect_line {
my($self) = shift;
my($fh) = shift;
@@ -133,44 +123,6 @@ sub line_number {
}
-sub create_array {
- my($self) = shift;
- my($line) = shift;
- my(@array) = ();
- my($length) = length($line);
- my($prev) = 0;
- my($double) = 0;
-
- for(my $i = 0; $i <= $length; $i++) {
- my($ch) = substr($line, $i, 1);
- if (!$double && ($ch eq '' || $ch =~ /\s/)) {
- my($val) = substr($line, $prev, $i - $prev);
- $val =~ s/^\s+//;
- $val =~ s/\s+$//;
- if ($val =~ /^\"(.*)\"$/) {
- $val = $1;
- }
- push(@array, $val);
- for(; $i < $length; $i++) {
- if (substr($line, $i, 1) !~ /\s/) {
- $i--;
- last;
- }
- }
- $prev = $i + 1;
- }
- elsif ($double && $ch eq "\\" && $i + 1 < $length) {
- substr($line, $i, 1) = '';
- $length--;
- }
- elsif ($ch eq '"') {
- $double ^= 1;
- }
- }
- return \@array;
-}
-
-
sub slash_to_backslash {
my($self) = shift;
my($file) = shift;