Commits

Johannes Köster committed 27e6f95

Fixed unexpected EOF in parser.

  • Participants
  • Parent commits 9f7e1bb

Comments (1)

Files changed (1)

snakemake/parser.py

     return token.type == tokenize.STRING
 
 
+def is_eof(token):
+    return token.type == tokenize.ENDMARKER
+
+
 def lineno(token):
     return token.start[0]
 
         if self.lasttoken == "\n" and is_comment(token):
             # ignore lines containing only comments
             self.line -= 1
-        if self.line and self.indent <= 0:
+        if (self.line and self.indent <= 0) or is_eof(token):
             for t, token_ in self.decorate_end(token):
                 yield t, token_
             yield "\n", token