From: Guido van Rossum Date: Sun, 20 Oct 1991 20:20:00 +0000 (+0000) Subject: Implemented 2-character operators. X-Git-Tag: v0.9.8~790 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c64d04dedd1800cfc02a72e0109f0b806f644535;p=thirdparty%2FPython%2Fcpython.git Implemented 2-character operators. --- diff --git a/Parser/grammar.c b/Parser/grammar.c index 57ff347b3c1a..3e31b07eecd8 100644 --- a/Parser/grammar.c +++ b/Parser/grammar.c @@ -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));