From 5773449edb2cbf8026107818379509f12fb319a0 Mon Sep 17 00:00:00 2001 From: Sei Lisa Date: Tue, 5 Aug 2014 15:55:49 +0200 Subject: [PATCH] Convert warnings to add the WARNING: title in the function. --- lslopt/lsloptimizer.py | 4 ++-- lslopt/lsloutput.py | 4 ++-- lslopt/lslparse.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lslopt/lsloptimizer.py b/lslopt/lsloptimizer.py index 3f228d5..629eac5 100644 --- a/lslopt/lsloptimizer.py +++ b/lslopt/lsloptimizer.py @@ -430,7 +430,7 @@ class optimizer(renamer, deadcode): fn = self.symtab[0][node['name']]['Fn'] value = fn(*tuple(arg['value'] for arg in child)) if not self.foldtabs and isinstance(value, unicode) and '\t' in value: - warning('WARNING: Tab in function result and foldtabs option not used.') + warning('Tab in function result and foldtabs option not used.') return parent[index] = {'nt':'CONST', 't':node['t'], 'value':value} elif node['name'] == 'llGetListLength' and child[0]['nt'] == 'IDENT': @@ -662,7 +662,7 @@ class optimizer(renamer, deadcode): self.FoldTree(tree, idx) self.globalmode = False if not self.IsValidGlobalConstant(tree[idx]): - warning('WARNING: Expression does not resolve to a single constant.') + warning('Expression does not resolve to a single constant.') else: self.FoldTree(tree, idx) diff --git a/lslopt/lsloutput.py b/lslopt/lsloutput.py index 4b092c0..72e1d0e 100644 --- a/lslopt/lsloutput.py +++ b/lslopt/lsloutput.py @@ -23,7 +23,7 @@ class outscript(object): # is lost. So we emit a warning instead, letting the compiler # report the error in the generated source. if self.globalmode and self.listmode: - warning('WARNING: Illegal combo: Key type inside a global list') + warning('Illegal combo: Key type inside a global list') if self.listmode or not self.globalmode: if self.globalmode: pfx = '(key)' @@ -31,7 +31,7 @@ class outscript(object): pfx = '((key)' sfx = ')' if '\t' in value: - warning('WARNING: A string contains a tab. Tabs are expanded to four' + warning('A string contains a tab. Tabs are expanded to four' ' spaces by the viewer when copy-pasting the code.') return pfx + '"' + value.encode('utf8').replace('\\','\\\\') \ .replace('"','\\"').replace('\n','\\n') + '"' + sfx diff --git a/lslopt/lslparse.py b/lslopt/lslparse.py index a996e6f..67e78e5 100644 --- a/lslopt/lslparse.py +++ b/lslopt/lslparse.py @@ -10,7 +10,7 @@ import random def warning(txt): assert type(txt) == str - sys.stderr.write(txt + '\n') + sys.stderr.write('WARNING: ' + txt + '\n') def isdigit(c): return '0' <= c <= '9'