Author: esr
Date: Thu Mar 20 21:26:51 2008
New Revision: 24909
URL: http://svn.gna.org/viewcvs/wesnoth?rev=24909&view=rev
Log:
Add an "alignment" type check to wmllint.
Modified:
trunk/data/tools/wesnoth/wmltools.py
trunk/data/tools/wmlscope
Modified: trunk/data/tools/wesnoth/wmltools.py
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/wesnoth/wmltools.py?rev=24909&r1=24908&r2=24909&view=diff
==============================================================================
--- trunk/data/tools/wesnoth/wmltools.py (original)
+++ trunk/data/tools/wesnoth/wmltools.py Thu Mar 20 21:26:51 2008
@@ -112,6 +112,8 @@
ftype = "span"
elif f in ("RANGE",):
ftype = "range"
+ elif f in ("ALIGN",):
+ ftype = "alignment"
elif f in ("TERRAIN",):
ftype = "terrain_code"
elif f in ("NAME", "VAR", "IMAGESTEM", "ID") or f.endswith("_NAME"):
@@ -135,6 +137,8 @@
return ftype
def actualtype(a):
+ if a is None:
+ return None
# Deduce the type of the actual
if a.isdigit() or a.startswith("-") and a[1:].isdigit():
atype = "numeric"
@@ -144,6 +148,8 @@
atype = "span"
elif a in ("melee", "ranged"):
atype = "range"
+ elif a in ("lawful", "neutral", "chaotic"):
+ atype = "alignment"
elif a.startswith("{") and a.endswith("}") or a.startswith("$"):
atype = None # Can't tell -- it's a macro expansion
elif re.match(image_reference, a):
Modified: trunk/data/tools/wmlscope
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/wmlscope?rev=24909&r1=24908&r2=24909&view=diff
==============================================================================
--- trunk/data/tools/wmlscope (original)
+++ trunk/data/tools/wmlscope Thu Mar 20 21:26:51 2008
@@ -160,10 +160,8 @@
print "%s: macro %s(%s) has mismatches:" % (m, n, ",
".join(map(lambda x: "%s=%s" % (x, formaltype(x)), m.args)))
for (file, refs) in m.references.items():
for (ln, args) in refs:
- try:
- print '"%s", line %d: %s(%s) with signature (%s)'
% (file, ln, n, ", ".join(args), ", ".join(map(lambda f, a: "%s=%s" % (f,
actualtype(a)), m.args, args)))
- except AttributeError:
- print '"%s", line %d: internal error in reporter'
% (file, ln)
+ print '"%s", line %d: %s(%s) with signature (%s)' %
(file, ln, n, ", ".join(args), ", ".join(map(lambda f, a: "%s=%s" % (f,
actualtype(a)), m.args, args)))
+
def duplicates(self, exportonly):
"Dump duplicate unit IDs."
duplicate_latch = False
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits