src/eric7/DataViews/CodeMetrics.py

branch
eric7
changeset 10065
de4ae767b0e3
parent 10060
b946699e9e79
child 10423
299802979277
equal deleted inserted replaced
10064:8c3207703dac 10065:de4ae767b0e3
119 # stack of active identifiers and indent levels 119 # stack of active identifiers and indent levels
120 self.counters = {} 120 self.counters = {}
121 # counters per identifier 121 # counters per identifier
122 self.indent_level = 0 122 self.indent_level = 0
123 123
124 def indent(self, tok): 124 def indent(self):
125 """ 125 """
126 Public method used to increment the indentation level. 126 Public method used to increment the indentation level.
127
128 @param tok a token (Token, ignored)
129 """ 127 """
130 self.indent_level += 1 128 self.indent_level += 1
131 129
132 def dedent(self, tok): 130 def dedent(self, tok):
133 """ 131 """
232 elif parser.tokenlist[idx - 1].type == COMMENT: 230 elif parser.tokenlist[idx - 1].type == COMMENT:
233 continue 231 continue
234 else: 232 else:
235 stats.inc("empty") 233 stats.inc("empty")
236 elif tok.type == INDENT: 234 elif tok.type == INDENT:
237 stats.indent(tok) 235 stats.indent()
238 elif tok.type == DEDENT: 236 elif tok.type == DEDENT:
239 stats.dedent(tok) 237 stats.dedent(tok)
240 elif tok.type == KEYWORD and tok.text in ("class", "def"): 238 elif tok.type == KEYWORD and tok.text in ("class", "def"):
241 stats.push(parser.tokenlist[idx + 1].text, tok.row) 239 stats.push(parser.tokenlist[idx + 1].text, tok.row)
242 240

eric ide

mercurial