summaryrefslogtreecommitdiffstats
path: root/Parser/grammar.c
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2000-08-24 20:11:32 (GMT)
committerThomas Wouters <thomas@python.org>2000-08-24 20:11:32 (GMT)
commit434d0828d81855692d45c3fdc0905a67c17d83ba (patch)
treefb920985e81a5c4091f75800ebdea7ed33a657e0 /Parser/grammar.c
parentdd8dbdb7172fbafb5ffab8600e620103fc19879e (diff)
downloadcpython-434d0828d81855692d45c3fdc0905a67c17d83ba.zip
cpython-434d0828d81855692d45c3fdc0905a67c17d83ba.tar.gz
cpython-434d0828d81855692d45c3fdc0905a67c17d83ba.tar.bz2
Support for three-token characters (**=, >>=, <<=) which was written by
Michael Hudson, and support in general for the augmented assignment syntax. The graminit.c patch is large!
Diffstat (limited to 'Parser/grammar.c')
-rw-r--r--Parser/grammar.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/Parser/grammar.c b/Parser/grammar.c
index 07e59ff..c4efce7 100644
--- a/Parser/grammar.c
+++ b/Parser/grammar.c
@@ -211,6 +211,18 @@ translabel(grammar *g, label *lb)
printf("Unknown OP label %s\n",
lb->lb_str);
}
+ else if (lb->lb_str[2] && lb->lb_str[3] && lb->lb_str[4] == lb->lb_str[0]) {
+ int type = (int) PyToken_ThreeChars(lb->lb_str[1],
+ lb->lb_str[2],
+ lb->lb_str[3]);
+ if (type != OP) {
+ lb->lb_type = type;
+ lb->lb_str = NULL;
+ }
+ else
+ printf("Unknown OP label %s\n",
+ lb->lb_str);
+ }
else
printf("Can't translate STRING label %s\n",
lb->lb_str);