Make wmlparser fail hard on a tag formed like [ this],

...where wesnoth's parser ignores the whitespace. Previously this was
treated as a differently named tag and could cause strange errors in
other places.
This commit is contained in:
Alexander van Gessel 2010-02-16 17:05:50 +01:00
parent 3002ffe6d5
commit 73bdcb5a68

View file

@ -789,6 +789,11 @@ class Parser:
subdata.set_meta(self.filename, self.line)
self.parse_top(subdata, name)
data.insert(subdata)
elif name[0] == " ":
# We single this case out explicitly as the wesnoth parser
# ignores it due to implementation reasons and this makes
# more sense of the error message
raise Error(self, "Invalid tag [%s] contains whitespace" % name)
else:
subdata = wmldata.DataSub(name)
subdata.set_meta(self.filename, self.line)