Add the ability to change the warning level with in-line comments.
This commit is contained in:
parent
001af46e6e
commit
e140ac971f
2 changed files with 22 additions and 0 deletions
|
@ -239,6 +239,8 @@ class CrossRef:
|
|||
self.xref = {}
|
||||
self.fileref = {}
|
||||
self.noxref = False
|
||||
if warnlevel >=2:
|
||||
print "*** Beginning definition-gathering pass..."
|
||||
for filename in self.filelist.generator():
|
||||
if warnlevel > 1:
|
||||
print filename + ":"
|
||||
|
@ -253,6 +255,12 @@ class CrossRef:
|
|||
print `line`[1:-1]
|
||||
if line.strip().startswith("#textdomain"):
|
||||
continue
|
||||
m = re.search("# *wmlscope: warnlevel ([0-9]*)", line)
|
||||
if m:
|
||||
warnlevel = int(m.group(1))
|
||||
print '"%s", line %d: warnlevel set to %d (definition-gathering pass)' \
|
||||
% (filename, n+1, warnlevel)
|
||||
continue
|
||||
elif line.strip().startswith("#define"):
|
||||
tokens = line.split()
|
||||
name = tokens[1]
|
||||
|
@ -306,6 +314,8 @@ class CrossRef:
|
|||
self.unresolved = []
|
||||
self.missing = []
|
||||
formals = []
|
||||
if warnlevel >=2:
|
||||
print "*** Beginning reference-gathering pass..."
|
||||
for fn in self.filelist.generator():
|
||||
if iswml(fn):
|
||||
rfp = open(fn)
|
||||
|
@ -318,6 +328,12 @@ class CrossRef:
|
|||
formals = []
|
||||
comment = ""
|
||||
if '#' in line:
|
||||
m = re.search("# *wmlscope: warnlevel ([0-9]*)", line)
|
||||
if m:
|
||||
warnlevel = int(m.group(1))
|
||||
print '"%s", line %d: warnlevel set to %d (reference-gathering pass)' \
|
||||
% (fn, n+1, warnlevel)
|
||||
continue
|
||||
fields = line.split('#')
|
||||
line = fields[0]
|
||||
if len(fields) > 1:
|
||||
|
|
|
@ -51,6 +51,12 @@
|
|||
# WML-interpreter rules it has not.
|
||||
#
|
||||
# The reporting format is compatible with GNU Emacs compile mode.
|
||||
#
|
||||
# For debugging purposes, an in-line comment of the form
|
||||
#
|
||||
# # wmlscope: warnlevel NNN
|
||||
#
|
||||
# sets the warning level.
|
||||
|
||||
import sys, os, time, re, getopt, md5
|
||||
from wesnoth.wmltools import *
|
||||
|
|
Loading…
Add table
Reference in a new issue