mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
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!
This commit is contained in:
parent
dd8dbdb717
commit
434d0828d8
7 changed files with 1401 additions and 890 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue