summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1991-10-20 20:20:00 (GMT)
committerGuido van Rossum <guido@python.org>1991-10-20 20:20:00 (GMT)
commitc64d04dedd1800cfc02a72e0109f0b806f644535 (patch)
tree25b620b12504d0cfcc0ae09efb275ed62a18be63
parent2df7bcca97c8501be1b4c6739ac48196b7f04975 (diff)
downloadcpython-c64d04dedd1800cfc02a72e0109f0b806f644535.zip
cpython-c64d04dedd1800cfc02a72e0109f0b806f644535.tar.gz
cpython-c64d04dedd1800cfc02a72e0109f0b806f644535.tar.bz2
Implemented 2-character operators.
-rw-r--r--Parser/grammar.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/Parser/grammar.c b/Parser/grammar.c
index 57ff347..3e31b07 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));