[wmlunits] Python parser now handles [+tag] WML syntax correctly.

This commit is contained in:
Elias Pschernig 2009-09-26 22:32:58 +00:00
parent daef8edd86
commit 751e1df222

View file

@ -771,14 +771,21 @@ class Parser:
if state == name[1:]:
return
raise Error(self, "Mismatched closing tag [%s], expected [/%s]" % (name, state))
#TODO: make a [+tag] properly append to most recent [tag]
# The below is an ugly hack, but better than keeping the '+' in the tag name.
elif name[0] == '+':
name = name[1:]
subdata = wmldata.DataSub(name)
subdata.set_meta(self.filename, self.line)
self.parse_top(subdata, name)
data.insert(subdata)
try:
subdata = data.dict[name][-1]
self.parse_top(subdata, name)
except KeyError:
subdata = wmldata.DataSub(name)
subdata.set_meta(self.filename, self.line)
self.parse_top(subdata, name)
data.insert(subdata)
else:
subdata = wmldata.DataSub(name)
subdata.set_meta(self.filename, self.line)
self.parse_top(subdata, name)
data.insert(subdata)
elif c == '{':
keep_macro = self.parse_macro()
if isinstance(keep_macro, wmldata.Data):