106 """ |
106 """ |
107 def __init__(self): |
107 def __init__(self): |
108 """ |
108 """ |
109 Constructor |
109 Constructor |
110 """ |
110 """ |
111 self.identifiers = [] # list of identifiers in order of appearance |
111 self.identifiers = [] |
112 self.active = [('TOTAL ', -1, 0)] # stack of active identifiers and indent levels |
112 # list of identifiers in order of appearance |
113 self.counters = {} # counters per identifier |
113 self.active = [('TOTAL ', -1, 0)] |
|
114 # stack of active identifiers and indent levels |
|
115 self.counters = {} |
|
116 # counters per identifier |
114 self.indent_level = 0 |
117 self.indent_level = 0 |
115 |
118 |
116 def indent(self, tok): |
119 def indent(self, tok): |
117 """ |
120 """ |
118 Public method used to increment the indentation level. |
121 Public method used to increment the indentation level. |
251 # collect overall statistics |
254 # collect overall statistics |
252 summarize(total, 'lines', parser.lines) |
255 summarize(total, 'lines', parser.lines) |
253 summarize(total, 'bytes', len(text)) |
256 summarize(total, 'bytes', len(text)) |
254 summarize(total, 'comments', stats.getCounter('TOTAL ', 'comments')) |
257 summarize(total, 'comments', stats.getCounter('TOTAL ', 'comments')) |
255 summarize(total, 'empty lines', stats.getCounter('TOTAL ', 'empty')) |
258 summarize(total, 'empty lines', stats.getCounter('TOTAL ', 'empty')) |
256 summarize(total, 'non-commentary lines', stats.getCounter('TOTAL ', 'nloc')) |
259 summarize(total, 'non-commentary lines', |
|
260 stats.getCounter('TOTAL ', 'nloc')) |
257 |
261 |
258 return stats |
262 return stats |
259 |
263 |
260 |
264 |
261 def main(): |
265 def main(): |