[Python-checkins] python/dist/src/Python compile.c,2.242,2.243 graminit.c,2.32,2.33

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
2002年5月24日 08:47:08 -0700


Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv941/Python
Modified Files:
	compile.c graminit.c 
Log Message:
Disambiguate the grammar for backtick.
The old syntax suggested that a trailing comma was OK inside backticks,
but in fact (due to ideosyncrasies of pgen) it was not. Fix the grammar
to avoid the ambiguity. Fred: you may want to update the refman.
Index: compile.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v
retrieving revision 2.242
retrieving revision 2.243
diff -C2 -d -r2.242 -r2.243
*** compile.c	26 Apr 2002 01:57:19 -0000	2.242
--- compile.c	24 May 2002 15:47:06 -0000	2.243
***************
*** 2475,2478 ****
--- 2475,2479 ----
 		case exprlist:
 		case testlist:
+ 		case testlist1:
 			if (NCH(n) > 1) {
 				if (assigning > OP_APPLY) {
***************
*** 2956,2959 ****
--- 2957,2961 ----
 	case expr_stmt:
 	case testlist:
+ 	case testlist1:
 	case test:
 	case and_test:
***************
*** 3357,3360 ****
--- 3359,3363 ----
 	case expr_stmt:
 	case testlist:
+ 	case testlist1:
 	case test:
 	case and_test:
***************
*** 3705,3708 ****
--- 3708,3712 ----
 	
 	case testlist:
+ 	case testlist1:
 	case testlist_safe:
 		com_list(c, n, 0);
***************
*** 5448,5451 ****
--- 5452,5456 ----
 	case exprlist:
 	case testlist:
+ 	case testlist1:
 		if (NCH(n) == 1) {
 			n = CHILD(n, 0);
Index: graminit.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/graminit.c,v
retrieving revision 2.32
retrieving revision 2.33
diff -C2 -d -r2.32 -r2.33
*** graminit.c	23 May 2002 20:05:40 -0000	2.32
--- graminit.c	24 May 2002 15:47:06 -0000	2.33
***************
*** 1021,1026 ****
 	{133, 4},
 	{12, 5},
! 	{134, 5},
! 	{135, 6},
 };
 static arc arcs_49_1[2] = {
--- 1021,1026 ----
 	{133, 4},
 	{12, 5},
! 	{135, 5},
! 	{136, 6},
 };
 static arc arcs_49_1[2] = {
***************
*** 1037,1041 ****
 };
 static arc arcs_49_4[1] = {
! 	{9, 10},
 };
 static arc arcs_49_5[1] = {
--- 1037,1041 ----
 };
 static arc arcs_49_4[1] = {
! 	{134, 10},
 };
 static arc arcs_49_5[1] = {
***************
*** 1043,1047 ****
 };
 static arc arcs_49_6[2] = {
! 	{135, 6},
 	{0, 6},
 };
--- 1043,1047 ----
 };
 static arc arcs_49_6[2] = {
! 	{136, 6},
 	{0, 6},
 };
***************
*** 1075,1079 ****
 };
 static arc arcs_50_1[3] = {
! 	{136, 2},
 	{22, 3},
 	{0, 1},
--- 1075,1079 ----
 };
 static arc arcs_50_1[3] = {
! 	{137, 2},
 	{22, 3},
 	{0, 1},
***************
*** 1098,1102 ****
 };
 static arc arcs_51_0[1] = {
! 	{137, 1},
 };
 static arc arcs_51_1[2] = {
--- 1098,1102 ----
 };
 static arc arcs_51_0[1] = {
! 	{138, 1},
 };
 static arc arcs_51_1[2] = {
***************
*** 1126,1134 ****
 };
 static arc arcs_52_1[2] = {
! 	{138, 4},
 	{18, 5},
 };
 static arc arcs_52_2[1] = {
! 	{139, 6},
 };
 static arc arcs_52_3[1] = {
--- 1126,1134 ----
 };
 static arc arcs_52_1[2] = {
! 	{139, 4},
 	{18, 5},
 };
 static arc arcs_52_2[1] = {
! 	{140, 6},
 };
 static arc arcs_52_3[1] = {
***************
*** 1154,1158 ****
 };
 static arc arcs_53_0[1] = {
! 	{140, 1},
 };
 static arc arcs_53_1[2] = {
--- 1154,1158 ----
 };
 static arc arcs_53_0[1] = {
! 	{141, 1},
 };
 static arc arcs_53_1[2] = {
***************
*** 1161,1165 ****
 };
 static arc arcs_53_2[2] = {
! 	{140, 1},
 	{0, 2},
 };
--- 1161,1165 ----
 };
 static arc arcs_53_2[2] = {
! 	{141, 1},
 	{0, 2},
 };
***************
*** 1183,1187 ****
 static arc arcs_54_3[3] = {
 	{21, 5},
! 	{141, 6},
 	{0, 3},
 };
--- 1183,1187 ----
 static arc arcs_54_3[3] = {
 	{21, 5},
! 	{142, 6},
 	{0, 3},
 };
***************
*** 1190,1194 ****
 };
 static arc arcs_54_5[2] = {
! 	{141, 6},
 	{0, 5},
 };
--- 1190,1194 ----
 };
 static arc arcs_54_5[2] = {
! 	{142, 6},
 	{0, 5},
 };
***************
*** 1302,1306 ****
 };
 static arc arcs_60_0[1] = {
! 	{143, 1},
 };
 static arc arcs_60_1[1] = {
--- 1302,1306 ----
 };
 static arc arcs_60_0[1] = {
! 	{144, 1},
 };
 static arc arcs_60_1[1] = {
***************
*** 1337,1341 ****
 };
 static arc arcs_61_0[3] = {
! 	{144, 1},
 	{23, 2},
 	{24, 3},
--- 1337,1341 ----
 };
 static arc arcs_61_0[3] = {
! 	{145, 1},
 	{23, 2},
 	{24, 3},
***************
*** 1352,1356 ****
 };
 static arc arcs_61_4[4] = {
! 	{144, 1},
 	{23, 2},
 	{24, 3},
--- 1352,1356 ----
 };
 static arc arcs_61_4[4] = {
! 	{145, 1},
 	{23, 2},
 	{24, 3},
***************
*** 1397,1402 ****
 };
 static arc arcs_63_0[2] = {
! 	{136, 1},
! 	{146, 1},
 };
 static arc arcs_63_1[1] = {
--- 1397,1402 ----
 };
 static arc arcs_63_0[2] = {
! 	{137, 1},
! 	{147, 1},
 };
 static arc arcs_63_1[1] = {
***************
*** 1417,1424 ****
 };
 static arc arcs_64_3[1] = {
! 	{142, 4},
 };
 static arc arcs_64_4[2] = {
! 	{145, 5},
 	{0, 4},
 };
--- 1417,1424 ----
 };
 static arc arcs_64_3[1] = {
! 	{143, 4},
 };
 static arc arcs_64_4[2] = {
! 	{146, 5},
 	{0, 4},
 };
***************
*** 1441,1445 ****
 };
 static arc arcs_65_2[2] = {
! 	{145, 3},
 	{0, 2},
 };
--- 1441,1445 ----
 };
 static arc arcs_65_2[2] = {
! 	{146, 3},
 	{0, 2},
 };
***************
*** 1453,1463 ****
 	{1, arcs_65_3},
 };
! static dfa dfas[66] = {
 	{256, "single_input", 0, 3, states_0,
! 	 "004円030円001円000円000円000円124円360円213円011円162円000円002円000円140円210円344円202円000円"},
 	{257, "file_input", 0, 2, states_1,
! 	 "204円030円001円000円000円000円124円360円213円011円162円000円002円000円140円210円344円202円000円"},
 	{258, "eval_input", 0, 3, states_2,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円002円000円140円210円344円002円000円"},
 	{259, "funcdef", 0, 6, states_3,
 	 "000円010円000円000円000円000円000円000円000円000円000円000円000円000円000円000円000円000円000円"},
--- 1453,1474 ----
 	{1, arcs_65_3},
 };
! static arc arcs_66_0[1] = {
! 	{21, 1},
! };
! static arc arcs_66_1[2] = {
! 	{22, 0},
! 	{0, 1},
! };
! static state states_66[2] = {
! 	{1, arcs_66_0},
! 	{2, arcs_66_1},
! };
! static dfa dfas[67] = {
 	{256, "single_input", 0, 3, states_0,
! 	 "004円030円001円000円000円000円124円360円213円011円162円000円002円000円140円210円244円005円001円"},
 	{257, "file_input", 0, 2, states_1,
! 	 "204円030円001円000円000円000円124円360円213円011円162円000円002円000円140円210円244円005円001円"},
 	{258, "eval_input", 0, 3, states_2,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円002円000円140円210円244円005円000円"},
 	{259, "funcdef", 0, 6, states_3,
 	 "000円010円000円000円000円000円000円000円000円000円000円000円000円000円000円000円000円000円000円"},
***************
*** 1471,1481 ****
 	 "000円020円001円000円000円000円000円000円000円000円000円000円000円000円000円000円000円000円000円"},
 	{264, "stmt", 0, 2, states_8,
! 	 "000円030円001円000円000円000円124円360円213円011円162円000円002円000円140円210円344円202円000円"},
 	{265, "simple_stmt", 0, 4, states_9,
! 	 "000円020円001円000円000円000円124円360円213円011円000円000円002円000円140円210円344円002円000円"},
 	{266, "small_stmt", 0, 2, states_10,
! 	 "000円020円001円000円000円000円124円360円213円011円000円000円002円000円140円210円344円002円000円"},
 	{267, "expr_stmt", 0, 6, states_11,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円002円000円140円210円344円002円000円"},
 	{268, "augassign", 0, 2, states_12,
 	 "000円000円000円000円300円377円003円000円000円000円000円000円000円000円000円000円000円000円000円"},
--- 1482,1492 ----
 	 "000円020円001円000円000円000円000円000円000円000円000円000円000円000円000円000円000円000円000円"},
 	{264, "stmt", 0, 2, states_8,
! 	 "000円030円001円000円000円000円124円360円213円011円162円000円002円000円140円210円244円005円001円"},
 	{265, "simple_stmt", 0, 4, states_9,
! 	 "000円020円001円000円000円000円124円360円213円011円000円000円002円000円140円210円244円005円000円"},
 	{266, "small_stmt", 0, 2, states_10,
! 	 "000円020円001円000円000円000円124円360円213円011円000円000円002円000円140円210円244円005円000円"},
 	{267, "expr_stmt", 0, 6, states_11,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円002円000円140円210円244円005円000円"},
 	{268, "augassign", 0, 2, states_12,
 	 "000円000円000円000円300円377円003円000円000円000円000円000円000円000円000円000円000円000円000円"},
***************
*** 1513,1517 ****
 	 "000円000円000円000円000円000円000円000円000円010円000円000円000円000円000円000円000円000円000円"},
 	{285, "compound_stmt", 0, 2, states_29,
! 	 "000円010円000円000円000円000円000円000円000円000円162円000円000円000円000円000円000円200円000円"},
 	{286, "if_stmt", 0, 8, states_30,
 	 "000円000円000円000円000円000円000円000円000円000円002円000円000円000円000円000円000円000円000円"},
--- 1524,1528 ----
 	 "000円000円000円000円000円000円000円000円000円010円000円000円000円000円000円000円000円000円000円"},
 	{285, "compound_stmt", 0, 2, states_29,
! 	 "000円010円000円000円000円000円000円000円000円000円162円000円000円000円000円000円000円000円001円"},
 	{286, "if_stmt", 0, 8, states_30,
 	 "000円000円000円000円000円000円000円000円000円000円002円000円000円000円000円000円000円000円000円"},
***************
*** 1525,1583 ****
 	 "000円000円000円000円000円000円000円000円000円000円000円002円000円000円000円000円000円000円000円"},
 	{291, "suite", 0, 5, states_35,
! 	 "004円020円001円000円000円000円124円360円213円011円000円000円002円000円140円210円344円002円000円"},
 	{292, "test", 0, 4, states_36,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円002円000円140円210円344円002円000円"},
 	{293, "and_test", 0, 2, states_37,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円002円000円140円210円344円000円000円"},
 	{294, "not_test", 0, 3, states_38,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円002円000円140円210円344円000円000円"},
 	{295, "comparison", 0, 2, states_39,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円000円000円140円210円344円000円000円"},
 	{296, "comp_op", 0, 4, states_40,
 	 "000円000円000円000円000円000円000円000円000円004円000円000円362円017円000円000円000円000円000円"},
 	{297, "expr", 0, 2, states_41,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円000円000円140円210円344円000円000円"},
 	{298, "xor_expr", 0, 2, states_42,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円000円000円140円210円344円000円000円"},
 	{299, "and_expr", 0, 2, states_43,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円000円000円140円210円344円000円000円"},
 	{300, "shift_expr", 0, 2, states_44,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円000円000円140円210円344円000円000円"},
 	{301, "arith_expr", 0, 2, states_45,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円000円000円140円210円344円000円000円"},
 	{302, "term", 0, 2, states_46,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円000円000円140円210円344円000円000円"},
 	{303, "factor", 0, 3, states_47,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円000円000円140円210円344円000円000円"},
 	{304, "power", 0, 4, states_48,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円000円000円000円200円344円000円000円"},
 	{305, "atom", 0, 11, states_49,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円000円000円000円200円344円000円000円"},
 	{306, "listmaker", 0, 5, states_50,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円002円000円140円210円344円002円000円"},
 	{307, "lambdef", 0, 5, states_51,
! 	 "000円000円000円000円000円000円000円000円000円000円000円000円000円000円000円000円000円002円000円"},
 	{308, "trailer", 0, 7, states_52,
 	 "000円000円001円000円000円000円000円000円100円000円000円000円000円000円000円200円000円000円000円"},
 	{309, "subscriptlist", 0, 3, states_53,
! 	 "000円120円001円000円000円000円000円000円100円000円000円000円002円000円140円210円344円002円000円"},
 	{310, "subscript", 0, 7, states_54,
! 	 "000円120円001円000円000円000円000円000円100円000円000円000円002円000円140円210円344円002円000円"},
 	{311, "sliceop", 0, 3, states_55,
 	 "000円100円000円000円000円000円000円000円000円000円000円000円000円000円000円000円000円000円000円"},
 	{312, "exprlist", 0, 3, states_56,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円000円000円140円210円344円000円000円"},
 	{313, "testlist", 0, 3, states_57,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円002円000円140円210円344円002円000円"},
 	{314, "testlist_safe", 0, 5, states_58,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円002円000円140円210円344円002円000円"},
 	{315, "dictmaker", 0, 5, states_59,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円002円000円140円210円344円002円000円"},
 	{316, "classdef", 0, 8, states_60,
! 	 "000円000円000円000円000円000円000円000円000円000円000円000円000円000円000円000円000円200円000円"},
 	{317, "arglist", 0, 8, states_61,
! 	 "000円020円201円001円000円000円000円000円000円000円000円000円002円000円140円210円344円002円000円"},
 	{318, "argument", 0, 4, states_62,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円002円000円140円210円344円002円000円"},
 	{319, "list_iter", 0, 2, states_63,
 	 "000円000円000円000円000円000円000円000円000円000円042円000円000円000円000円000円000円000円000円"},
--- 1536,1594 ----
 	 "000円000円000円000円000円000円000円000円000円000円000円002円000円000円000円000円000円000円000円"},
 	{291, "suite", 0, 5, states_35,
! 	 "004円020円001円000円000円000円124円360円213円011円000円000円002円000円140円210円244円005円000円"},
 	{292, "test", 0, 4, states_36,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円002円000円140円210円244円005円000円"},
 	{293, "and_test", 0, 2, states_37,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円002円000円140円210円244円001円000円"},
 	{294, "not_test", 0, 3, states_38,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円002円000円140円210円244円001円000円"},
 	{295, "comparison", 0, 2, states_39,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円000円000円140円210円244円001円000円"},
 	{296, "comp_op", 0, 4, states_40,
 	 "000円000円000円000円000円000円000円000円000円004円000円000円362円017円000円000円000円000円000円"},
 	{297, "expr", 0, 2, states_41,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円000円000円140円210円244円001円000円"},
 	{298, "xor_expr", 0, 2, states_42,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円000円000円140円210円244円001円000円"},
 	{299, "and_expr", 0, 2, states_43,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円000円000円140円210円244円001円000円"},
 	{300, "shift_expr", 0, 2, states_44,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円000円000円140円210円244円001円000円"},
 	{301, "arith_expr", 0, 2, states_45,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円000円000円140円210円244円001円000円"},
 	{302, "term", 0, 2, states_46,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円000円000円140円210円244円001円000円"},
 	{303, "factor", 0, 3, states_47,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円000円000円140円210円244円001円000円"},
 	{304, "power", 0, 4, states_48,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円000円000円000円200円244円001円000円"},
 	{305, "atom", 0, 11, states_49,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円000円000円000円200円244円001円000円"},
 	{306, "listmaker", 0, 5, states_50,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円002円000円140円210円244円005円000円"},
 	{307, "lambdef", 0, 5, states_51,
! 	 "000円000円000円000円000円000円000円000円000円000円000円000円000円000円000円000円000円004円000円"},
 	{308, "trailer", 0, 7, states_52,
 	 "000円000円001円000円000円000円000円000円100円000円000円000円000円000円000円200円000円000円000円"},
 	{309, "subscriptlist", 0, 3, states_53,
! 	 "000円120円001円000円000円000円000円000円100円000円000円000円002円000円140円210円244円005円000円"},
 	{310, "subscript", 0, 7, states_54,
! 	 "000円120円001円000円000円000円000円000円100円000円000円000円002円000円140円210円244円005円000円"},
 	{311, "sliceop", 0, 3, states_55,
 	 "000円100円000円000円000円000円000円000円000円000円000円000円000円000円000円000円000円000円000円"},
 	{312, "exprlist", 0, 3, states_56,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円000円000円140円210円244円001円000円"},
 	{313, "testlist", 0, 3, states_57,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円002円000円140円210円244円005円000円"},
 	{314, "testlist_safe", 0, 5, states_58,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円002円000円140円210円244円005円000円"},
 	{315, "dictmaker", 0, 5, states_59,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円002円000円140円210円244円005円000円"},
 	{316, "classdef", 0, 8, states_60,
! 	 "000円000円000円000円000円000円000円000円000円000円000円000円000円000円000円000円000円000円001円"},
 	{317, "arglist", 0, 8, states_61,
! 	 "000円020円201円001円000円000円000円000円000円000円000円000円002円000円140円210円244円005円000円"},
 	{318, "argument", 0, 4, states_62,
! 	 "000円020円001円000円000円000円000円000円000円000円000円000円002円000円140円210円244円005円000円"},
 	{319, "list_iter", 0, 2, states_63,
 	 "000円000円000円000円000円000円000円000円000円000円042円000円000円000円000円000円000円000円000円"},
***************
*** 1586,1591 ****
 	{321, "list_if", 0, 4, states_65,
 	 "000円000円000円000円000円000円000円000円000円000円002円000円000円000円000円000円000円000円000円"},
 };
! static label labels[147] = {
 	{0, "EMPTY"},
 	{256, 0},
--- 1597,1604 ----
 	{321, "list_if", 0, 4, states_65,
 	 "000円000円000円000円000円000円000円000円000円000円002円000円000円000円000円000円000円000円000円"},
+ 	{322, "testlist1", 0, 2, states_66,
+ 	 "000円020円001円000円000円000円000円000円000円000円000円000円002円000円140円210円244円005円000円"},
 };
! static label labels[148] = {
 	{0, "EMPTY"},
 	{256, 0},
***************
*** 1722,1725 ****
--- 1735,1739 ----
 	{27, 0},
 	{25, 0},
+ 	{322, 0},
 	{2, 0},
 	{3, 0},
***************
*** 1737,1743 ****
 };
 grammar _PyParser_Grammar = {
! 	66,
 	dfas,
! 	{147, labels},
 	256
 };
--- 1751,1757 ----
 };
 grammar _PyParser_Grammar = {
! 	67,
 	dfas,
! 	{148, labels},
 	256
 };

AltStyle によって変換されたページ (->オリジナル) /