]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Implemented 2-character operators.
authorGuido van Rossum <guido@python.org>
Sun, 20 Oct 1991 20:20:00 +0000 (20:20 +0000)
committerGuido van Rossum <guido@python.org>
Sun, 20 Oct 1991 20:20:00 +0000 (20:20 +0000)
Parser/grammar.c

index 57ff347b3c1a0dbc4ff8e8c3b2522468a096452f..3e31b07eecd8587cc4eeb9e8418d9eeccd475a03 100644 (file)
@@ -212,21 +212,30 @@ translabel(g, lb)
                        if (p)
                                *p = '\0';
                }
-               else {
-                       if (lb->lb_str[2] == lb->lb_str[0]) {
-                               int type = (int) tok_1char(lb->lb_str[1]);
-                               if (type != OP) {
-                                       lb->lb_type = type;
-                                       lb->lb_str = NULL;
-                               }
-                               else
-                                       printf("Unknown OP label %s\n",
-                                               lb->lb_str);
+               else if (lb->lb_str[2] == lb->lb_str[0]) {
+                       int type = (int) tok_1char(lb->lb_str[1]);
+                       if (type != OP) {
+                               lb->lb_type = type;
+                               lb->lb_str = NULL;
+                       }
+                       else
+                               printf("Unknown OP label %s\n",
+                                       lb->lb_str);
+               }
+               else if (lb->lb_str[2] && lb->lb_str[3] == lb->lb_str[0]) {
+                       int type = (int) tok_2char(lb->lb_str[1],
+                                                  lb->lb_str[2]);
+                       if (type != OP) {
+                               lb->lb_type = type;
+                               lb->lb_str = NULL;
                        }
                        else
-                               printf("Can't translate STRING label %s\n",
+                               printf("Unknown OP label %s\n",
                                        lb->lb_str);
                }
+               else
+                       printf("Can't translate STRING label %s\n",
+                               lb->lb_str);
        }
        else
                printf("Can't translate label '%s'\n", labelrepr(lb));