terryyin / lizard

A simple code complexity analyser without caring about the C/C++ header files or Java imports, supports most of the popular languages.
Other
1.85k stars 250 forks source link

IndexError: pop from empty list errors #53

Closed tholin closed 9 years ago

tholin commented 9 years ago

I ran lizard on various projects and got a bunch of pop from empty list errors. Here are some samples https://www.dropbox.com/s/h43p1b4uozqly59/vgabios.c from qemu https://www.dropbox.com/s/bpib35xzrq3hik3/arg9.C from gcc https://www.dropbox.com/s/u5o94tbgn7do6d6/temp_arg_nontype.cpp from llvm https://www.dropbox.com/s/k49d5ywfav58im0/johab.c from glibc https://www.dropbox.com/s/slnz4uhxv8mul0h/common.h from tcmalloc

Traceback (most recent call last):
  File "/home/cocobo/repository/lizard/lizard", line 6, in <module>
    lizard_main(sys.argv)
  File "/home/cocobo/repository/lizard/lizard.py", line 944, in lizard_main
    printer(result, options)
  File "/home/cocobo/repository/lizard/lizard.py", line 821, in print_result
    code_infos, option.extensions, scheme)
  File "/home/cocobo/repository/lizard/lizard.py", line 789, in print_and_save_modules
    for module_info in all_modules:
  File "/home/cocobo/repository/lizard/lizard.py", line 644, in __call__
    filename, open(filename, 'rU').read())
  File "/home/cocobo/repository/lizard/lizard.py", line 656, in analyze_source_code
    for _ in tokens:
  File "/home/cocobo/repository/lizard/lizard.py", line 631, in token_processor_for_function
    reader.state(token)
  File "/home/cocobo/repository/lizard/lizard.py", line 323, in state
    self._state(token)
  File "/home/cocobo/repository/lizard/lizard.py", line 457, in _state_template_in_name
    if self.bracket_stack.pop() != "<":
IndexError: pop from empty list
terryyin commented 9 years ago

These are all tested and passed.