Browse Source

Working nicer, but will probably get rid of one conditional check

master
freesource 22 years ago
parent
commit
c86b14e069
  1. 37
      BootRoot/Yard.pm

37
BootRoot/Yard.pm

@ -286,6 +286,8 @@ sub read_contents_file {
# ls cd bash # ls cd bash
# echo \ # echo \
# First line found with \ && may be an if () # First line found with \ && may be an if ()
if ( $line =~ /\s*\\/ ) { if ( $line =~ /\s*\\/ ) {
@ -327,8 +329,15 @@ sub read_contents_file {
} }
} # end for glob condition } # end for glob condition
if ( file_exists( $globbed[0] ) eq "FALSE" ) {
next LINE;
}
# Couldn't find a condition # Couldn't find a condition
if ( !@globbed ) { if ( !@globbed ) {
cf_warn($contents_file, $line, cf_warn($contents_file, $line,
@ -357,7 +366,6 @@ sub read_contents_file {
} }
# Next line if it exists between \ \ # Next line if it exists between \ \
elsif ( %control_structure && $control_structure{WATCH} < 2 ) { elsif ( %control_structure && $control_structure{WATCH} < 2 ) {
@ -429,11 +437,17 @@ sub read_contents_file {
next LINE; next LINE;
} }
#next LINE;
} }
} # end for glob condition } # end for glob condition
if ( file_exists( $globbed[0] ) eq "FALSE" ) {
next LINE;
}
# Couldn't find a condition # Couldn't find a condition
if ( !@globbed ) { if ( !@globbed ) {
cf_warn($contents_file, $line, cf_warn($contents_file, $line,
@ -472,7 +486,7 @@ sub read_contents_file {
if ( $line =~ m,\s*else\s*|\s*elsif\s*, ) { if ( $line =~ m,\s*else\s*|\s*elsif\s*, ) {
######### #########
if ( $line =~ m,\s*elsif\s*\(.*\)\s*, ) { if ( $line =~ m,\s*elsif\s*, ) {
$control_structure{elsif}++; $control_structure{elsif}++;
@ -502,10 +516,15 @@ sub read_contents_file {
next LINE; next LINE;
} }
#next LINE;
} }
} # end for glob condition } # end for glob condition
if ( file_exists( $globbed[0] ) eq "FALSE" ) {
next LINE;
}
# Couldn't find a condition # Couldn't find a condition
if ( !@globbed ) { if ( !@globbed ) {
cf_warn($contents_file, $line, cf_warn($contents_file, $line,
@ -539,15 +558,27 @@ sub read_contents_file {
next LINE; next LINE;
} }
}
##
} }
# Control Structure Trap
# If a condition is false the control structure falls through until it
# reaches a true condtion, this prevents that.
if (
$line =~ m,\s*if\(.*\)|\s*elsif\(.*\)|\s*else\s*, ) {
print "$line IMADEITHERE\n";
next LINE;
} }
# last line found with ending \ can be besides a statement or by itself # last line found with ending \ can be besides a statement or by itself
elsif ( %control_structure && $control_structure{WATCH} == 2 ) { if ( %control_structure && $control_structure{WATCH} == 2 ) {
# Better make sure we actually get here # Better make sure we actually get here

Loading…
Cancel
Save