made the script a bit more robust

This commit is contained in:
Gunter Labes 2009-05-05 20:23:07 +00:00
parent 00a466f67d
commit 99bd36664a

View file

@ -36,10 +36,12 @@ Using a simple stack to keep track of the current tag is Ayin's idea.
while ( <> ) {
s/\s+//g;
next if /^#/;
next if /^\s*#/;
# ignore [tag][/tag]
next if /\[\+?(\w+)\]\s*\[\/(\w+)\]/;
chomp;
unshift @tags,$1 if /\[\+?(\w*)\]/;
if ( /\[\/(\w*)\]/ ) {
unshift @tags,$1 if /^\s*\[\+?(\w+)\]\s*(|#.*)$/;
if ( /\[\/(\w+)\]/ ) {
die "bad WML in $ARGV, [/$1] found inside [@tags[0]], quitting"
if $1 ne @tags[0];
shift @tags;