wmlscope now constructs implicit references to attack icons.
This commit is contained in:
parent
7a0e950ffe
commit
0cdc363178
2 changed files with 35 additions and 6 deletions
|
@ -207,6 +207,8 @@ class CrossRef:
|
|||
for fn in self.filelist.generator():
|
||||
if iswml(fn):
|
||||
rfp = open(fn)
|
||||
attack_name = None
|
||||
beneath = 0
|
||||
for (n, line) in enumerate(rfp):
|
||||
if line.startswith("#define"):
|
||||
formals = line.split()[2:]
|
||||
|
@ -260,7 +262,34 @@ class CrossRef:
|
|||
if len(candidates) > 1:
|
||||
print "%s: more than one definition of %s is visible here (%s)." % (Reference(fn, n), name, ", ".join(candidates))
|
||||
if not key:
|
||||
self.missing.append((name, Reference(fn,n+1)))
|
||||
self.missing.append((name, Reference(fn,n+1))) # Notice implicit references through attacks
|
||||
if state == "outside":
|
||||
if "[attack]" in line:
|
||||
beneath = 0
|
||||
attack_name = default_icon = None
|
||||
have_icon = False
|
||||
elif "name=" in line:
|
||||
attack_name = line[line.find("name=")+5:].strip()
|
||||
default_icon = os.path.join("attacks", attack_name + ".png")
|
||||
elif "icon=" in line and beneath == 0:
|
||||
have_icon = True
|
||||
elif "[/attack]" in line:
|
||||
if attack_name and not have_icon:
|
||||
candidates = []
|
||||
key = None
|
||||
for trial in self.fileref:
|
||||
if trial.endswith(os.sep + default_icon) and self.visible_from(trial, fn, n):
|
||||
key = trial
|
||||
self.fileref[trial].append(fn, n+1)
|
||||
candidates.append(trial)
|
||||
if len(candidates) > 1:
|
||||
print "%s: more than one definition of %s is visible here (%s)." % (Reference(fn, n), name, ", ".join(candidates))
|
||||
if not key:
|
||||
self.missing.append((default_icon, Reference(fn,n+1)))
|
||||
elif line.strip().startswith("[/"):
|
||||
beneath -= 1
|
||||
elif line.strip().startswith("["):
|
||||
beneath += 1
|
||||
rfp.close()
|
||||
def subtract(self, filelist):
|
||||
"Transplant file references in files from filelist to a new CrossRef."
|
||||
|
|
|
@ -16,6 +16,10 @@
|
|||
# the first directory should point at a copy of mainline and all later
|
||||
# ones at UMC.)
|
||||
#
|
||||
# This tool does catch one kind of implicit reference: if an attack name
|
||||
# is specified but no icon is given, the attack icon will default to
|
||||
# a name generated from the attack name,
|
||||
#
|
||||
# The checking done by this tool has a couple of flaws:
|
||||
#
|
||||
# (1) It doesn't actually evaluate file inclusions. Instead, any
|
||||
|
@ -38,13 +42,9 @@
|
|||
# statically matching the pattern as having been referenced even
|
||||
# though none of the actual macro calls would actually generate it.
|
||||
#
|
||||
# (4) There are some implicit references. Notably, if an attack name
|
||||
# is specified but no icon is given, the attack icon will default to
|
||||
# a name generated from the attack name,
|
||||
#
|
||||
# Problems (1) and (2) imply that this tool might conceivably report
|
||||
# that a reference has been satisfied when under actual
|
||||
# WML-interpreter rules it has not. Problem (4) means the reverse
|
||||
# WML-interpreter rules it has not.
|
||||
# can also occur.
|
||||
#
|
||||
# The reporting format is compatible with GNU Emacs compile mode.
|
||||
|
|
Loading…
Add table
Reference in a new issue