munificent / vigil

Vigil, the eternal morally vigilant programming language
2.9k stars 61 forks source link

Punish code without a valid entry point... e.g. no/bad main() #11

Open acharlieh opened 11 years ago

acharlieh commented 11 years ago

It could come to pass that code given to vigil may not have a main method, or said main method could throw an exception.

I propose that in such cases the provided file be wiped from this earth, but currently I instead wind up with:

$ touch empty_file.vg 
$ ../vigil empty_file.vg 
uncaught error from line  3
Traceback (most recent call last):
  File "../vigil", line 94, in <module>
    exec(source)
  File "<string>", line 5, in <module>
  File "../vigil", line 76, in vigil_uncaught
    punish(raise_line, "Raised '%s' which was not caught." % sys.exc_info()[1])
  File "../vigil", line 19, in punish
    if re.match('def ', source_lines[start]):
IndexError: list index out of range