[Python-checkins] cpython (merge 3.2 -> default): Issue #13629: Renumber the tokens in token.h to match the _PyParser_TokenNames

meador.inge python-checkins at python.org
Mon Jan 16 02:34:25 CET 2012


http://hg.python.org/cpython/rev/c0660d7cc1fe
changeset:   74422:c0660d7cc1fe
parent:      74420:6099d9dd0c26
parent:      74421:1c0c6fa7341c
user:        Meador Inge <meadori at gmail.com>
date:        Sun Jan 15 19:31:57 2012 -0600
summary:
  Issue #13629: Renumber the tokens in token.h to match the _PyParser_TokenNames indexes.

files:
  Include/token.h   |  61 +++++++++++++++++-----------------
  Lib/token.py      |  60 +++++++++++++++++-----------------
  Misc/NEWS         |   3 +
  Python/graminit.c |  30 ++++++++--------
  4 files changed, 78 insertions(+), 76 deletions(-)


diff --git a/Include/token.h b/Include/token.h
--- a/Include/token.h
+++ b/Include/token.h
@@ -34,38 +34,37 @@
 #define EQUAL		22
 #define DOT		23
 #define PERCENT		24
-/* #define BACKQUOTE	25 */
-#define LBRACE		26
-#define RBRACE		27
-#define EQEQUAL		28
-#define NOTEQUAL	29
-#define LESSEQUAL	30
-#define GREATEREQUAL	31
-#define TILDE		32
-#define CIRCUMFLEX	33
-#define LEFTSHIFT	34
-#define RIGHTSHIFT	35
-#define DOUBLESTAR	36
-#define PLUSEQUAL	37
-#define MINEQUAL	38
-#define STAREQUAL	39
-#define SLASHEQUAL	40
-#define PERCENTEQUAL	41
-#define AMPEREQUAL	42
-#define VBAREQUAL	43
-#define CIRCUMFLEXEQUAL	44
-#define LEFTSHIFTEQUAL	45
-#define RIGHTSHIFTEQUAL	46
-#define DOUBLESTAREQUAL	47
-#define DOUBLESLASH	48
-#define DOUBLESLASHEQUAL 49
-#define AT              50	
-#define RARROW          51
-#define ELLIPSIS        52
+#define LBRACE		25
+#define RBRACE		26
+#define EQEQUAL		27
+#define NOTEQUAL	28
+#define LESSEQUAL	29
+#define GREATEREQUAL	30
+#define TILDE		31
+#define CIRCUMFLEX	32
+#define LEFTSHIFT	33
+#define RIGHTSHIFT	34
+#define DOUBLESTAR	35
+#define PLUSEQUAL	36
+#define MINEQUAL	37
+#define STAREQUAL	38
+#define SLASHEQUAL	39
+#define PERCENTEQUAL	40
+#define AMPEREQUAL	41
+#define VBAREQUAL	42
+#define CIRCUMFLEXEQUAL	43
+#define LEFTSHIFTEQUAL	44
+#define RIGHTSHIFTEQUAL	45
+#define DOUBLESTAREQUAL	46
+#define DOUBLESLASH	47
+#define DOUBLESLASHEQUAL 48
+#define AT              49	
+#define RARROW          50
+#define ELLIPSIS        51
 /* Don't forget to update the table _PyParser_TokenNames in tokenizer.c! */
-#define OP		53
-#define ERRORTOKEN	54
-#define N_TOKENS	55
+#define OP		52
+#define ERRORTOKEN	53
+#define N_TOKENS	54
 
 /* Special definitions for cooperation with parser */
 
diff --git a/Lib/token.py b/Lib/token.py
--- a/Lib/token.py
+++ b/Lib/token.py
@@ -35,36 +35,36 @@
 EQUAL = 22
 DOT = 23
 PERCENT = 24
-LBRACE = 26
-RBRACE = 27
-EQEQUAL = 28
-NOTEQUAL = 29
-LESSEQUAL = 30
-GREATEREQUAL = 31
-TILDE = 32
-CIRCUMFLEX = 33
-LEFTSHIFT = 34
-RIGHTSHIFT = 35
-DOUBLESTAR = 36
-PLUSEQUAL = 37
-MINEQUAL = 38
-STAREQUAL = 39
-SLASHEQUAL = 40
-PERCENTEQUAL = 41
-AMPEREQUAL = 42
-VBAREQUAL = 43
-CIRCUMFLEXEQUAL = 44
-LEFTSHIFTEQUAL = 45
-RIGHTSHIFTEQUAL = 46
-DOUBLESTAREQUAL = 47
-DOUBLESLASH = 48
-DOUBLESLASHEQUAL = 49
-AT = 50
-RARROW = 51
-ELLIPSIS = 52
-OP = 53
-ERRORTOKEN = 54
-N_TOKENS = 55
+LBRACE = 25
+RBRACE = 26
+EQEQUAL = 27
+NOTEQUAL = 28
+LESSEQUAL = 29
+GREATEREQUAL = 30
+TILDE = 31
+CIRCUMFLEX = 32
+LEFTSHIFT = 33
+RIGHTSHIFT = 34
+DOUBLESTAR = 35
+PLUSEQUAL = 36
+MINEQUAL = 37
+STAREQUAL = 38
+SLASHEQUAL = 39
+PERCENTEQUAL = 40
+AMPEREQUAL = 41
+VBAREQUAL = 42
+CIRCUMFLEXEQUAL = 43
+LEFTSHIFTEQUAL = 44
+RIGHTSHIFTEQUAL = 45
+DOUBLESTAREQUAL = 46
+DOUBLESLASH = 47
+DOUBLESLASHEQUAL = 48
+AT = 49
+RARROW = 50
+ELLIPSIS = 51
+OP = 52
+ERRORTOKEN = 53
+N_TOKENS = 54
 NT_OFFSET = 256
 #--end constants--
 
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,9 @@
 Core and Builtins
 -----------------
 
+- Issue #13629: Renumber the tokens in token.h so that they match the indexes
+  into _PyParser_TokenNames.
+
 - Issue #13752: Add a casefold() method to str.
 
 - Issue #13761: Add a "flush" keyword argument to the print() function,
diff --git a/Python/graminit.c b/Python/graminit.c
--- a/Python/graminit.c
+++ b/Python/graminit.c
@@ -1995,7 +1995,7 @@
     {258, 0},
     {327, 0},
     {259, 0},
-    {50, 0},
+    {49, 0},
     {289, 0},
     {7, 0},
     {330, 0},
@@ -2007,7 +2007,7 @@
     {1, "def"},
     {1, 0},
     {263, 0},
-    {51, 0},
+    {50, 0},
     {302, 0},
     {11, 0},
     {301, 0},
@@ -2016,7 +2016,7 @@
     {22, 0},
     {12, 0},
     {16, 0},
-    {36, 0},
+    {35, 0},
     {266, 0},
     {267, 0},
     {270, 0},
@@ -2033,6 +2033,7 @@
     {273, 0},
     {336, 0},
     {311, 0},
+    {36, 0},
     {37, 0},
     {38, 0},
     {39, 0},
@@ -2043,8 +2044,7 @@
     {44, 0},
     {45, 0},
     {46, 0},
-    {47, 0},
-    {49, 0},
+    {48, 0},
     {1, "del"},
     {326, 0},
     {1, "pass"},
@@ -2063,7 +2063,7 @@
     {1, "import"},
     {288, 0},
     {23, 0},
-    {52, 0},
+    {51, 0},
     {287, 0},
     {285, 0},
     {1, "as"},
@@ -2105,38 +2105,38 @@
     {310, 0},
     {20, 0},
     {21, 0},
-    {28, 0},
-    {31, 0},
+    {27, 0},
     {30, 0},
     {29, 0},
-    {29, 0},
+    {28, 0},
+    {28, 0},
     {1, "is"},
     {313, 0},
     {18, 0},
     {314, 0},
-    {33, 0},
+    {32, 0},
     {315, 0},
     {19, 0},
     {316, 0},
+    {33, 0},
     {34, 0},
-    {35, 0},
     {317, 0},
     {14, 0},
     {15, 0},
     {318, 0},
     {17, 0},
     {24, 0},
-    {48, 0},
-    {32, 0},
+    {47, 0},
+    {31, 0},
     {319, 0},
     {320, 0},
     {322, 0},
     {321, 0},
     {9, 0},
     {10, 0},
+    {25, 0},
+    {328, 0},
     {26, 0},
-    {328, 0},
-    {27, 0},
     {2, 0},
     {3, 0},
     {1, "None"},

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list