minor code cleanup in parser
authorStefan Behnel <stefan_ml@behnel.de>
Thu, 28 Jun 2012 09:29:20 +0000 (11:29 +0200)
committerStefan Behnel <stefan_ml@behnel.de>
Thu, 28 Jun 2012 09:29:20 +0000 (11:29 +0200)
Cython/Compiler/Parsing.py

index 8f76f62..1b191c6 100644 (file)
@@ -2354,11 +2354,11 @@ def p_c_simple_declarator(s, ctx, empty, is_type, cmethod_flag,
                 elif op == '[':
                     s.expect(']')
                     op = '[]'
-                if op in ['-', '+', '|', '&'] and s.sy == op:
-                    op = op*2
+                elif op in ('-', '+', '|', '&') and s.sy == op:
+                    op *= 2       # ++, --, ...
                     s.next()
-                if s.sy == '=':
-                    op += s.sy
+                elif s.sy == '=':
+                    op += s.sy    # +=, -=, ...
                     s.next()
                 if op not in supported_overloaded_operators:
                     s.error("Overloading operator '%s' not yet supported." % op)