Skip to content

Commit e3adbe7

Browse files
committed
Sets new DEBUG_LEVEL for the preprocessor
For ID class, it defaults to 3.
1 parent 7b170b9 commit e3adbe7

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

zxbpp/prepro/id_.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
from api.debug import __DEBUG__
1414
from .output import CURRENT_FILE
1515

16+
DEBUG_LEVEL = 3 # Which -d level is required to show debug info
17+
1618

1719
class ID:
1820
""" This class represents an identifier. It stores a string
@@ -52,37 +54,35 @@ def __dumptable(table):
5254
sys.stdout.write("\n")
5355

5456
def __call__(self, table):
55-
__DEBUG__("evaluating id '%s'" % self.name)
57+
__DEBUG__("evaluating id '%s'" % self.name, DEBUG_LEVEL)
5658
if self.value is None:
57-
__DEBUG__("undefined (null) value. BUG?")
59+
__DEBUG__("undefined (null) value. BUG?", DEBUG_LEVEL)
5860
return ''
5961

6062
result = ''
6163
for token in self.value:
62-
__DEBUG__("evaluating token '%s'" % str(token))
64+
__DEBUG__("evaluating token '%s'" % str(token), DEBUG_LEVEL)
6365
if isinstance(token, MacroCall):
64-
__DEBUG__("token '%s'(%s) is a MacroCall" %
65-
(token.id_, str(token)))
66+
__DEBUG__("token '%s'(%s) is a MacroCall" % (token.id_, str(token)), DEBUG_LEVEL)
6667
if table.defined(token.id_):
6768
tmp = table[token.id_]
68-
__DEBUG__("'%s' is defined in the symbol table as '%s'" %
69-
(token.id_, tmp.name))
69+
__DEBUG__("'%s' is defined in the symbol table as '%s'" % (token.id_, tmp.name), DEBUG_LEVEL)
7070

7171
if isinstance(tmp, ID) and not tmp.hasArgs:
72-
__DEBUG__("'%s' is an ID" % tmp.name)
72+
__DEBUG__("'%s' is an ID" % tmp.name, DEBUG_LEVEL)
7373
token = copy.deepcopy(token)
7474
token.id_ = tmp(table)
75-
__DEBUG__("'%s' is the new id" % token.id_)
75+
__DEBUG__("'%s' is the new id" % token.id_, DEBUG_LEVEL)
7676

77-
__DEBUG__("executing MacroCall '%s'" % token.id_)
77+
__DEBUG__("executing MacroCall '%s'" % token.id_, DEBUG_LEVEL)
7878
tmp = token(table)
7979
else:
8080
if isinstance(token, ID):
81-
__DEBUG__("token '%s' is an ID" % token.id_)
81+
__DEBUG__("token '%s' is an ID" % token.id_, DEBUG_LEVEL)
8282
token = token(table)
8383
tmp = token
8484

85-
__DEBUG__("token got value '%s'" % tmp)
85+
__DEBUG__("token got value '%s'" % tmp, DEBUG_LEVEL)
8686
result += tmp
8787

8888
return result

0 commit comments

Comments
 (0)