small cleanup in parser
authorStefan Behnel <scoder@users.berlios.de>
Sat, 20 Dec 2008 20:10:14 +0000 (21:10 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Sat, 20 Dec 2008 20:10:14 +0000 (21:10 +0100)
Cython/Compiler/Parsing.py

index 72e59cfa90b51b21091b343e61634a93b0ab3980..21b94883c78ec5a2f6ec965aa3350ceadff00135 100644 (file)
@@ -84,12 +84,9 @@ def p_simple_expr(s):
     if s.sy == 'if':
         s.next()
         test = p_or_test(s)
-        if s.sy == 'else':
-            s.next()
-            other = p_test(s)
-            return ExprNodes.CondExprNode(pos, test=test, true_val=expr, false_val=other)
-        else:
-            s.error("Expected 'else'")
+        s.expect('else')
+        other = p_test(s)
+        return ExprNodes.CondExprNode(pos, test=test, true_val=expr, false_val=other)
     else:
         return expr