]> Devi Nivas Git - chevron.git/commitdiff
Removed unnecessary custome exception
authornoah morrison <noah@morrison.ph>
Fri, 31 Oct 2014 19:06:52 +0000 (15:06 -0400)
committernoah morrison <noah@morrison.ph>
Fri, 31 Oct 2014 19:06:52 +0000 (15:06 -0400)
The custome exception EOF was not needed,
there is a built-in one called EOFError.

chevron.py

index 053c510b160cad140c87b77f98a5a12dc505e2df..7bd588d1be253bafe7a3452bc9d56bc18160e5e5 100755 (executable)
@@ -4,9 +4,6 @@ import sys
 
 
 def tokenize(template):
-    class EOF(Exception):
-        pass
-
     class UnclosedSection(Exception):
         pass
 
@@ -16,7 +13,7 @@ def tokenize(template):
     def look(ahead=0, amount=1):
         idx = current + ahead
         if idx > len(template):
-            raise EOF()
+            raise EOFError()
 
         return template[idx:idx + amount]
 
@@ -40,7 +37,7 @@ def tokenize(template):
             size = 0
             while look(size, 2) != l_del:
                 size += 1
-        except EOF:
+        except EOFError:
             yield ('literal', get(size))
             return