Author: esr
Date: Sun Mar 2 16:18:41 2008
New Revision: 24220
URL: http://svn.gna.org/viewcvs/wesnoth?rev=24220&view=rev
Log:
Minor bug fix.
Modified:
trunk/data/tools/wesnoth/wmltools.py
trunk/data/tools/wmllint
Modified: trunk/data/tools/wesnoth/wmltools.py
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/wesnoth/wmltools.py?rev=24220&r1=24219&r2=24220&view=diff
==============================================================================
--- trunk/data/tools/wesnoth/wmltools.py (original)
+++ trunk/data/tools/wesnoth/wmltools.py Sun Mar 2 16:18:41 2008
@@ -217,7 +217,7 @@
if defn.undef != None:
# Local macros are only visible in the file where they were defined
return defn.filename == fn and n >= defn.lineno and n <= defn.undef
- if self.properties[defn.namespace].get("export") == "yes":
+ if defn.namespace in self.properties and
self.properties[defn.namespace].get("export") == "yes":
# Macros and resources in subtrees with export=yes are global
return True
elif not self.filelist.neighbors(defn.filename, fn):
Modified: trunk/data/tools/wmllint
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/wmllint?rev=24220&r1=24219&r2=24220&view=diff
==============================================================================
--- trunk/data/tools/wmllint (original)
+++ trunk/data/tools/wmllint Sun Mar 2 16:18:41 2008
@@ -1822,6 +1822,23 @@
else:
# Map or mask -- just run everything together
transformed = "".join(newdata)
+ # Simple check for unbalanced macro calls
+ unclosed = None
+ linecount = 1
+ depth = 0
+ for i in range(len(transformed)):
+ if transformed[i] == '\n':
+ linecount += 1
+ elif transformed[i] == '{':
+ if depth == 0:
+ unclosed = linecount
+ depth += 1
+ elif transformed[i] == '}':
+ depth -= 1
+ if depth == 0:
+ unclosed = None
+ if unclosed:
+ print >>sys.stderr, '"%s", line %d: unbalanced {.' % (filename,
unclosed)
# Return None if the transformation functions made no changes.
if modified:
return transformed
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits