summaryrefslogtreecommitdiff
path: root/modules/Parser.pm
diff options
context:
space:
mode:
authorelliott_c <ocielliottc@users.noreply.github.com>2002-11-08 19:02:33 +0000
committerelliott_c <ocielliottc@users.noreply.github.com>2002-11-08 19:02:33 +0000
commit835d136975faf4055dd20c11779c32c3f202b597 (patch)
tree346596b271f139f2260a160aacb108fae2ed5e03 /modules/Parser.pm
parent72fcb6e19fb0929f107ab215a1cb5190a7d1ba38 (diff)
downloadMPC-835d136975faf4055dd20c11779c32c3f202b597.tar.gz
ChangeLogTag: Fri Nov 8 13:00:56 2002 Chad Elliott <elliott_c@ociweb.com>
Diffstat (limited to 'modules/Parser.pm')
-rw-r--r--modules/Parser.pm39
1 files changed, 29 insertions, 10 deletions
diff --git a/modules/Parser.pm b/modules/Parser.pm
index db0d0537..afc738ff 100644
--- a/modules/Parser.pm
+++ b/modules/Parser.pm
@@ -13,6 +13,8 @@ package Parser;
use strict;
use FileHandle;
+my($cwd) = Cwd::getcwd();
+
# ************************************************************
# Subroutine Section
# ************************************************************
@@ -25,11 +27,28 @@ sub new {
}
+sub cd {
+ my($self) = shift;
+ my($dir) = shift;
+ my($status) = chdir($dir);
+ if ($status) {
+ $cwd = $dir;
+ }
+ return $status;
+}
+
+
+sub getcwd {
+ #my($self) = shift;
+ return $cwd;
+}
+
+
sub strip_line {
my($self) = shift;
my($line) = shift;
- $self->{'line_number'}++;
+ ++$self->{'line_number'};
$line =~ s/\/\/.*//;
$line =~ s/^\s+//;
$line =~ s/\s+$//;
@@ -46,11 +65,11 @@ sub process_special {
for(my $i = 0; $i < $length; $i++) {
my($ch) = substr($line, $i, 1);
if ($ch eq "\\" && $i + 1 < $length) {
- substr($line, $i, 1) = "";
+ substr($line, $i, 1) = '';
$length--;
}
elsif ($ch eq '"') {
- substr($line, $i, 1) = "";
+ substr($line, $i, 1) = '';
$length--;
$i--;
}
@@ -64,7 +83,7 @@ sub read_file {
my($input) = shift;
my($ih) = new FileHandle();
my($status) = 1;
- my($errorString) = "";
+ my($errorString) = '';
$self->{'line_number'} = 0;
if (open($ih, $input)) {
@@ -80,7 +99,7 @@ sub read_file {
close($ih);
}
else {
- $errorString = "ERROR: Unable to open for reading";
+ $errorString = 'ERROR: Unable to open for reading';
$status = 0;
}
@@ -110,7 +129,7 @@ sub create_array {
for(my $i = 0; $i <= $length; $i++) {
my($ch) = substr($line, $i, 1);
- if (!$double && ($ch eq "" || $ch =~ /\s/)) {
+ if (!$double && ($ch eq '' || $ch =~ /\s/)) {
my($val) = substr($line, $prev, $i - $prev);
$val =~ s/^\s+//;
$val =~ s/\s+$//;
@@ -127,7 +146,7 @@ sub create_array {
$prev = $i + 1;
}
elsif ($double && $ch eq "\\" && $i + 1 < $length) {
- substr($line, $i, 1) = "";
+ substr($line, $i, 1) = '';
$length--;
}
elsif ($ch eq '"') {
@@ -151,9 +170,9 @@ sub slash_to_backslash {
# ************************************************************
sub parse_line {
- my($self) = shift;
- my($ih) = shift;
- my($line) = shift;
+ #my($self) = shift;
+ #my($ih) = shift;
+ #my($line) = shift;
}