diff options
author | goodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2004-08-17 23:13:26 +0000 |
---|---|---|
committer | goodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2004-08-17 23:13:26 +0000 |
commit | b65bf229a763511ce061b63f8aa66886189b4a58 (patch) | |
tree | 1f364a165e53876bfd23bc33f78293facfcf51e2 /lib | |
parent | b70434185c3e03b4c7c09e306c0872705bfc4ea9 (diff) |
Tweaking the file reader to allow continuation lines in strings again.
Note that this has made the syntax for continuation lines stricter - the
\ must be the last character in the line (line in C) - you may not have a
space or a comment after it.
git-svn-id: http://svn.cactuscode.org/flesh/trunk@3840 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sbin/CSTUtils.pl | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/lib/sbin/CSTUtils.pl b/lib/sbin/CSTUtils.pl index a5171a00..ae01571e 100644 --- a/lib/sbin/CSTUtils.pl +++ b/lib/sbin/CSTUtils.pl @@ -116,28 +116,26 @@ sub read_file { chomp; - # Remove comments. - $_ = &RemoveComments($_); -# $_ =~ s/\#.*//; - - # Ignore empty lines. - next if(m/^\s*$/); - - #&chompme($_); - # Add to the currently processed line. $line .= $_; - # Check the line for line-continuation - if(m:[^\\]\\\s*$:) + # Check if this line will be continued + if($line =~ m:[^\\]\\$:) { - $line =~ s:\\\s*$::; + $line =~ s:\\$::; + next; } - else + + # Remove comments. + $line = &RemoveComments($line); + + # Ignore empty lines. + if($line !~ m/^\s*$/) { push(@indata, $line); - $line = ""; } + + $line = ""; } # Make sure to dump out the last line, even if it ends in a \ @@ -145,6 +143,7 @@ sub read_file { push(@indata, $line); } + close IN; return @indata; @@ -444,7 +443,7 @@ sub RemoveComments if($insstring || $indstring) { - print "Error: Unterminated string while parsing interface for thorn : $thorn\n"; + print "Error: Unterminated string while parsing ccl file for thorn : $thorn\n"; print $nocomment; } |