Author: ai0867
Date: Wed Jun 3 15:33:09 2009
New Revision: 36044
URL: http://svn.gna.org/viewcvs/wesnoth?rev=36044&view=rev
Log:
Teach wmlparser to read << ... >> strings.
Modified:
trunk/data/tools/wesnoth/wmlparser.py
Modified: trunk/data/tools/wesnoth/wmlparser.py
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/wesnoth/wmlparser.py?rev=36044&r1=36043&r2=36044&view=diff
==============================================================================
--- trunk/data/tools/wesnoth/wmlparser.py (original)
+++ trunk/data/tools/wesnoth/wmlparser.py Wed Jun 3 15:33:09 2009
@@ -295,6 +295,19 @@
break
text += line
return text
+
+ def read_lua(self):
+ """
+ Read a << .... >> string, return contents literally.
+ """
+ text = ""
+ while not self.at_end():
+ c = self.read_next()
+ if c == ">" and self.peek_next() == ">":
+ self.read_next() #get rid of trailing >
+ return text
+ text += c
+ raise Error(self, "Unexpected end of file")
def skip_whitespace_inside_statement(self):
self.read_while(" \t\r\n")
@@ -536,12 +549,7 @@
line = -1
got_lua = False
while 1:
- if got_lua:
- if c == ">" and self.peek_next() == ">":
- got_lua = False
- elif got_assign and c == "<" and self.peek_next() == "<":
- got_lua = True
- elif c == "{":
+ if c == "{":
keep_macro = self.parse_macro()
if keep_macro:
if self.no_macros:
@@ -578,7 +586,10 @@
else:
variable += c
else:
- if c == '"':
+ if c == "<" and self.peek_next() == "<":
+ self.read_next() #skip the rest of the opening
+ value += self.read_lua()
+ elif c == '"':
# We want the textdomain at the beginning of the string,
# the end of the string may be outside a macro and already
# in another textdomain.
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits