Index: Python/graminit.c =================================================================== --- Python/graminit.c (revision 54264) +++ Python/graminit.c (working copy) @@ -148,7 +148,7 @@ static arc arcs_7_0[3] = { {26, 1}, {29, 2}, - {31, 3}, + {30, 3}, }; static arc arcs_7_1[3] = { {27, 4}, @@ -156,12 +156,12 @@ {0, 1}, }; static arc arcs_7_2[3] = { - {30, 6}, + {26, 6}, {28, 7}, {0, 2}, }; static arc arcs_7_3[1] = { - {30, 8}, + {26, 8}, }; static arc arcs_7_4[1] = { {22, 9}, @@ -169,7 +169,7 @@ static arc arcs_7_5[4] = { {26, 1}, {29, 2}, - {31, 3}, + {30, 3}, {0, 5}, }; static arc arcs_7_6[2] = { @@ -177,8 +177,8 @@ {0, 6}, }; static arc arcs_7_7[2] = { - {30, 10}, - {31, 3}, + {26, 10}, + {30, 3}, }; static arc arcs_7_8[1] = { {0, 8}, @@ -228,230 +228,164 @@ {1, arcs_8_2}, {1, arcs_8_3}, }; -static arc arcs_9_0[2] = { - {30, 1}, - {13, 2}, -}; -static arc arcs_9_1[1] = { - {0, 1}, -}; -static arc arcs_9_2[1] = { - {32, 3}, -}; -static arc arcs_9_3[1] = { - {15, 1}, -}; -static state states_9[4] = { - {2, arcs_9_0}, - {1, arcs_9_1}, - {1, arcs_9_2}, - {1, arcs_9_3}, -}; -static arc arcs_10_0[1] = { - {26, 1}, -}; -static arc arcs_10_1[2] = { - {28, 2}, - {0, 1}, -}; -static arc arcs_10_2[2] = { - {26, 1}, - {0, 2}, -}; -static state states_10[3] = { - {1, arcs_10_0}, - {2, arcs_10_1}, - {2, arcs_10_2}, -}; -static arc arcs_11_0[3] = { - {34, 1}, +static arc arcs_9_0[3] = { + {32, 1}, {29, 2}, - {31, 3}, + {30, 3}, }; -static arc arcs_11_1[3] = { +static arc arcs_9_1[3] = { {27, 4}, {28, 5}, {0, 1}, }; -static arc arcs_11_2[3] = { - {35, 6}, +static arc arcs_9_2[3] = { + {32, 6}, {28, 7}, {0, 2}, }; -static arc arcs_11_3[1] = { - {35, 8}, +static arc arcs_9_3[1] = { + {32, 8}, }; -static arc arcs_11_4[1] = { +static arc arcs_9_4[1] = { {22, 9}, }; -static arc arcs_11_5[4] = { - {34, 1}, +static arc arcs_9_5[4] = { + {32, 1}, {29, 2}, - {31, 3}, + {30, 3}, {0, 5}, }; -static arc arcs_11_6[2] = { +static arc arcs_9_6[2] = { {28, 7}, {0, 6}, }; -static arc arcs_11_7[2] = { - {35, 10}, - {31, 3}, +static arc arcs_9_7[2] = { + {32, 10}, + {30, 3}, }; -static arc arcs_11_8[1] = { +static arc arcs_9_8[1] = { {0, 8}, }; -static arc arcs_11_9[2] = { +static arc arcs_9_9[2] = { {28, 5}, {0, 9}, }; -static arc arcs_11_10[3] = { +static arc arcs_9_10[3] = { {28, 7}, {27, 11}, {0, 10}, }; -static arc arcs_11_11[1] = { +static arc arcs_9_11[1] = { {22, 6}, }; -static state states_11[12] = { - {3, arcs_11_0}, - {3, arcs_11_1}, - {3, arcs_11_2}, - {1, arcs_11_3}, - {1, arcs_11_4}, - {4, arcs_11_5}, - {2, arcs_11_6}, - {2, arcs_11_7}, - {1, arcs_11_8}, - {2, arcs_11_9}, - {3, arcs_11_10}, - {1, arcs_11_11}, +static state states_9[12] = { + {3, arcs_9_0}, + {3, arcs_9_1}, + {3, arcs_9_2}, + {1, arcs_9_3}, + {1, arcs_9_4}, + {4, arcs_9_5}, + {2, arcs_9_6}, + {2, arcs_9_7}, + {1, arcs_9_8}, + {2, arcs_9_9}, + {3, arcs_9_10}, + {1, arcs_9_11}, }; -static arc arcs_12_0[1] = { +static arc arcs_10_0[1] = { {19, 1}, }; -static arc arcs_12_1[1] = { +static arc arcs_10_1[1] = { {0, 1}, }; -static state states_12[2] = { - {1, arcs_12_0}, - {1, arcs_12_1}, +static state states_10[2] = { + {1, arcs_10_0}, + {1, arcs_10_1}, }; -static arc arcs_13_0[2] = { - {35, 1}, - {13, 2}, -}; -static arc arcs_13_1[1] = { - {0, 1}, -}; -static arc arcs_13_2[1] = { - {36, 3}, -}; -static arc arcs_13_3[1] = { - {15, 1}, -}; -static state states_13[4] = { - {2, arcs_13_0}, - {1, arcs_13_1}, - {1, arcs_13_2}, - {1, arcs_13_3}, -}; -static arc arcs_14_0[1] = { - {34, 1}, -}; -static arc arcs_14_1[2] = { - {28, 2}, - {0, 1}, -}; -static arc arcs_14_2[2] = { - {34, 1}, - {0, 2}, -}; -static state states_14[3] = { - {1, arcs_14_0}, - {2, arcs_14_1}, - {2, arcs_14_2}, -}; -static arc arcs_15_0[2] = { +static arc arcs_11_0[2] = { {3, 1}, {4, 1}, }; -static arc arcs_15_1[1] = { +static arc arcs_11_1[1] = { {0, 1}, }; -static state states_15[2] = { - {2, arcs_15_0}, - {1, arcs_15_1}, +static state states_11[2] = { + {2, arcs_11_0}, + {1, arcs_11_1}, }; -static arc arcs_16_0[1] = { - {37, 1}, +static arc arcs_12_0[1] = { + {33, 1}, }; -static arc arcs_16_1[2] = { - {38, 2}, +static arc arcs_12_1[2] = { + {34, 2}, {2, 3}, }; -static arc arcs_16_2[2] = { - {37, 1}, +static arc arcs_12_2[2] = { + {33, 1}, {2, 3}, }; -static arc arcs_16_3[1] = { +static arc arcs_12_3[1] = { {0, 3}, }; -static state states_16[4] = { - {1, arcs_16_0}, - {2, arcs_16_1}, - {2, arcs_16_2}, - {1, arcs_16_3}, +static state states_12[4] = { + {1, arcs_12_0}, + {2, arcs_12_1}, + {2, arcs_12_2}, + {1, arcs_12_3}, }; -static arc arcs_17_0[8] = { +static arc arcs_13_0[8] = { + {35, 1}, + {36, 1}, + {37, 1}, + {38, 1}, {39, 1}, {40, 1}, {41, 1}, {42, 1}, - {43, 1}, - {44, 1}, - {45, 1}, - {46, 1}, }; -static arc arcs_17_1[1] = { +static arc arcs_13_1[1] = { {0, 1}, }; -static state states_17[2] = { - {8, arcs_17_0}, - {1, arcs_17_1}, +static state states_13[2] = { + {8, arcs_13_0}, + {1, arcs_13_1}, }; -static arc arcs_18_0[1] = { +static arc arcs_14_0[1] = { {9, 1}, }; -static arc arcs_18_1[3] = { - {47, 2}, +static arc arcs_14_1[3] = { + {43, 2}, {27, 3}, {0, 1}, }; -static arc arcs_18_2[2] = { - {48, 4}, +static arc arcs_14_2[2] = { + {44, 4}, {9, 4}, }; -static arc arcs_18_3[2] = { - {48, 5}, +static arc arcs_14_3[2] = { + {44, 5}, {9, 5}, }; -static arc arcs_18_4[1] = { +static arc arcs_14_4[1] = { {0, 4}, }; -static arc arcs_18_5[2] = { +static arc arcs_14_5[2] = { {27, 3}, {0, 5}, }; -static state states_18[6] = { - {1, arcs_18_0}, - {3, arcs_18_1}, - {2, arcs_18_2}, - {2, arcs_18_3}, - {1, arcs_18_4}, - {2, arcs_18_5}, +static state states_14[6] = { + {1, arcs_14_0}, + {3, arcs_14_1}, + {2, arcs_14_2}, + {2, arcs_14_3}, + {1, arcs_14_4}, + {2, arcs_14_5}, }; -static arc arcs_19_0[12] = { +static arc arcs_15_0[12] = { + {45, 1}, + {46, 1}, + {47, 1}, + {48, 1}, {49, 1}, {50, 1}, {51, 1}, @@ -460,1611 +394,1599 @@ {54, 1}, {55, 1}, {56, 1}, - {57, 1}, - {58, 1}, - {59, 1}, - {60, 1}, }; -static arc arcs_19_1[1] = { +static arc arcs_15_1[1] = { {0, 1}, }; -static state states_19[2] = { - {12, arcs_19_0}, - {1, arcs_19_1}, +static state states_15[2] = { + {12, arcs_15_0}, + {1, arcs_15_1}, }; -static arc arcs_20_0[1] = { - {61, 1}, +static arc arcs_16_0[1] = { + {57, 1}, }; -static arc arcs_20_1[1] = { - {62, 2}, +static arc arcs_16_1[1] = { + {58, 2}, }; -static arc arcs_20_2[1] = { +static arc arcs_16_2[1] = { {0, 2}, }; -static state states_20[3] = { - {1, arcs_20_0}, - {1, arcs_20_1}, - {1, arcs_20_2}, +static state states_16[3] = { + {1, arcs_16_0}, + {1, arcs_16_1}, + {1, arcs_16_2}, }; -static arc arcs_21_0[1] = { - {63, 1}, +static arc arcs_17_0[1] = { + {59, 1}, }; -static arc arcs_21_1[1] = { +static arc arcs_17_1[1] = { {0, 1}, }; -static state states_21[2] = { - {1, arcs_21_0}, - {1, arcs_21_1}, +static state states_17[2] = { + {1, arcs_17_0}, + {1, arcs_17_1}, }; -static arc arcs_22_0[5] = { +static arc arcs_18_0[5] = { + {60, 1}, + {61, 1}, + {62, 1}, + {63, 1}, {64, 1}, - {65, 1}, - {66, 1}, - {67, 1}, - {68, 1}, }; -static arc arcs_22_1[1] = { +static arc arcs_18_1[1] = { {0, 1}, }; -static state states_22[2] = { - {5, arcs_22_0}, - {1, arcs_22_1}, +static state states_18[2] = { + {5, arcs_18_0}, + {1, arcs_18_1}, }; -static arc arcs_23_0[1] = { - {69, 1}, +static arc arcs_19_0[1] = { + {65, 1}, }; -static arc arcs_23_1[1] = { +static arc arcs_19_1[1] = { {0, 1}, }; -static state states_23[2] = { - {1, arcs_23_0}, - {1, arcs_23_1}, +static state states_19[2] = { + {1, arcs_19_0}, + {1, arcs_19_1}, }; -static arc arcs_24_0[1] = { - {70, 1}, +static arc arcs_20_0[1] = { + {66, 1}, }; -static arc arcs_24_1[1] = { +static arc arcs_20_1[1] = { {0, 1}, }; -static state states_24[2] = { - {1, arcs_24_0}, - {1, arcs_24_1}, +static state states_20[2] = { + {1, arcs_20_0}, + {1, arcs_20_1}, }; -static arc arcs_25_0[1] = { - {71, 1}, +static arc arcs_21_0[1] = { + {67, 1}, }; -static arc arcs_25_1[2] = { +static arc arcs_21_1[2] = { {9, 2}, {0, 1}, }; -static arc arcs_25_2[1] = { +static arc arcs_21_2[1] = { {0, 2}, }; -static state states_25[3] = { - {1, arcs_25_0}, - {2, arcs_25_1}, - {1, arcs_25_2}, +static state states_21[3] = { + {1, arcs_21_0}, + {2, arcs_21_1}, + {1, arcs_21_2}, }; -static arc arcs_26_0[1] = { - {48, 1}, +static arc arcs_22_0[1] = { + {44, 1}, }; -static arc arcs_26_1[1] = { +static arc arcs_22_1[1] = { {0, 1}, }; -static state states_26[2] = { - {1, arcs_26_0}, - {1, arcs_26_1}, +static state states_22[2] = { + {1, arcs_22_0}, + {1, arcs_22_1}, }; -static arc arcs_27_0[1] = { - {72, 1}, +static arc arcs_23_0[1] = { + {68, 1}, }; -static arc arcs_27_1[2] = { +static arc arcs_23_1[2] = { {22, 2}, {0, 1}, }; -static arc arcs_27_2[2] = { +static arc arcs_23_2[2] = { {28, 3}, {0, 2}, }; -static arc arcs_27_3[1] = { +static arc arcs_23_3[1] = { {22, 4}, }; -static arc arcs_27_4[2] = { +static arc arcs_23_4[2] = { {28, 5}, {0, 4}, }; -static arc arcs_27_5[1] = { +static arc arcs_23_5[1] = { {22, 6}, }; -static arc arcs_27_6[1] = { +static arc arcs_23_6[1] = { {0, 6}, }; -static state states_27[7] = { - {1, arcs_27_0}, - {2, arcs_27_1}, - {2, arcs_27_2}, - {1, arcs_27_3}, - {2, arcs_27_4}, - {1, arcs_27_5}, - {1, arcs_27_6}, +static state states_23[7] = { + {1, arcs_23_0}, + {2, arcs_23_1}, + {2, arcs_23_2}, + {1, arcs_23_3}, + {2, arcs_23_4}, + {1, arcs_23_5}, + {1, arcs_23_6}, }; -static arc arcs_28_0[2] = { - {73, 1}, - {74, 1}, +static arc arcs_24_0[2] = { + {69, 1}, + {70, 1}, }; -static arc arcs_28_1[1] = { +static arc arcs_24_1[1] = { {0, 1}, }; -static state states_28[2] = { - {2, arcs_28_0}, - {1, arcs_28_1}, +static state states_24[2] = { + {2, arcs_24_0}, + {1, arcs_24_1}, }; -static arc arcs_29_0[1] = { - {75, 1}, +static arc arcs_25_0[1] = { + {71, 1}, }; -static arc arcs_29_1[1] = { - {76, 2}, +static arc arcs_25_1[1] = { + {72, 2}, }; -static arc arcs_29_2[1] = { +static arc arcs_25_2[1] = { {0, 2}, }; -static state states_29[3] = { - {1, arcs_29_0}, - {1, arcs_29_1}, - {1, arcs_29_2}, +static state states_25[3] = { + {1, arcs_25_0}, + {1, arcs_25_1}, + {1, arcs_25_2}, }; -static arc arcs_30_0[1] = { - {77, 1}, +static arc arcs_26_0[1] = { + {73, 1}, }; -static arc arcs_30_1[2] = { - {78, 2}, +static arc arcs_26_1[2] = { + {74, 2}, {12, 3}, }; -static arc arcs_30_2[3] = { - {78, 2}, +static arc arcs_26_2[3] = { + {74, 2}, {12, 3}, - {75, 4}, + {71, 4}, }; -static arc arcs_30_3[1] = { - {75, 4}, +static arc arcs_26_3[1] = { + {71, 4}, }; -static arc arcs_30_4[3] = { +static arc arcs_26_4[3] = { {29, 5}, {13, 6}, - {79, 5}, + {75, 5}, }; -static arc arcs_30_5[1] = { +static arc arcs_26_5[1] = { {0, 5}, }; -static arc arcs_30_6[1] = { - {79, 7}, +static arc arcs_26_6[1] = { + {75, 7}, }; -static arc arcs_30_7[1] = { +static arc arcs_26_7[1] = { {15, 5}, }; -static state states_30[8] = { - {1, arcs_30_0}, - {2, arcs_30_1}, - {3, arcs_30_2}, - {1, arcs_30_3}, - {3, arcs_30_4}, - {1, arcs_30_5}, - {1, arcs_30_6}, - {1, arcs_30_7}, +static state states_26[8] = { + {1, arcs_26_0}, + {2, arcs_26_1}, + {3, arcs_26_2}, + {1, arcs_26_3}, + {3, arcs_26_4}, + {1, arcs_26_5}, + {1, arcs_26_6}, + {1, arcs_26_7}, }; -static arc arcs_31_0[1] = { +static arc arcs_27_0[1] = { {19, 1}, }; -static arc arcs_31_1[2] = { - {81, 2}, +static arc arcs_27_1[2] = { + {77, 2}, {0, 1}, }; -static arc arcs_31_2[1] = { +static arc arcs_27_2[1] = { {19, 3}, }; -static arc arcs_31_3[1] = { +static arc arcs_27_3[1] = { {0, 3}, }; -static state states_31[4] = { - {1, arcs_31_0}, - {2, arcs_31_1}, - {1, arcs_31_2}, - {1, arcs_31_3}, +static state states_27[4] = { + {1, arcs_27_0}, + {2, arcs_27_1}, + {1, arcs_27_2}, + {1, arcs_27_3}, }; -static arc arcs_32_0[1] = { +static arc arcs_28_0[1] = { {12, 1}, }; -static arc arcs_32_1[2] = { - {81, 2}, +static arc arcs_28_1[2] = { + {77, 2}, {0, 1}, }; -static arc arcs_32_2[1] = { +static arc arcs_28_2[1] = { {19, 3}, }; -static arc arcs_32_3[1] = { +static arc arcs_28_3[1] = { {0, 3}, }; -static state states_32[4] = { - {1, arcs_32_0}, - {2, arcs_32_1}, - {1, arcs_32_2}, - {1, arcs_32_3}, +static state states_28[4] = { + {1, arcs_28_0}, + {2, arcs_28_1}, + {1, arcs_28_2}, + {1, arcs_28_3}, }; -static arc arcs_33_0[1] = { - {80, 1}, +static arc arcs_29_0[1] = { + {76, 1}, }; -static arc arcs_33_1[2] = { +static arc arcs_29_1[2] = { {28, 2}, {0, 1}, }; -static arc arcs_33_2[2] = { - {80, 1}, +static arc arcs_29_2[2] = { + {76, 1}, {0, 2}, }; -static state states_33[3] = { - {1, arcs_33_0}, - {2, arcs_33_1}, - {2, arcs_33_2}, +static state states_29[3] = { + {1, arcs_29_0}, + {2, arcs_29_1}, + {2, arcs_29_2}, }; -static arc arcs_34_0[1] = { - {82, 1}, +static arc arcs_30_0[1] = { + {78, 1}, }; -static arc arcs_34_1[2] = { +static arc arcs_30_1[2] = { {28, 0}, {0, 1}, }; -static state states_34[2] = { - {1, arcs_34_0}, - {2, arcs_34_1}, +static state states_30[2] = { + {1, arcs_30_0}, + {2, arcs_30_1}, }; -static arc arcs_35_0[1] = { +static arc arcs_31_0[1] = { {19, 1}, }; -static arc arcs_35_1[2] = { - {78, 0}, +static arc arcs_31_1[2] = { + {74, 0}, {0, 1}, }; -static state states_35[2] = { - {1, arcs_35_0}, - {2, arcs_35_1}, +static state states_31[2] = { + {1, arcs_31_0}, + {2, arcs_31_1}, }; -static arc arcs_36_0[1] = { - {83, 1}, +static arc arcs_32_0[1] = { + {79, 1}, }; -static arc arcs_36_1[1] = { +static arc arcs_32_1[1] = { {19, 2}, }; -static arc arcs_36_2[2] = { +static arc arcs_32_2[2] = { {28, 1}, {0, 2}, }; -static state states_36[3] = { - {1, arcs_36_0}, - {1, arcs_36_1}, - {2, arcs_36_2}, +static state states_32[3] = { + {1, arcs_32_0}, + {1, arcs_32_1}, + {2, arcs_32_2}, }; -static arc arcs_37_0[1] = { - {84, 1}, +static arc arcs_33_0[1] = { + {80, 1}, }; -static arc arcs_37_1[1] = { +static arc arcs_33_1[1] = { {19, 2}, }; -static arc arcs_37_2[2] = { +static arc arcs_33_2[2] = { {28, 1}, {0, 2}, }; -static state states_37[3] = { - {1, arcs_37_0}, - {1, arcs_37_1}, - {2, arcs_37_2}, +static state states_33[3] = { + {1, arcs_33_0}, + {1, arcs_33_1}, + {2, arcs_33_2}, }; -static arc arcs_38_0[1] = { - {85, 1}, +static arc arcs_34_0[1] = { + {81, 1}, }; -static arc arcs_38_1[1] = { +static arc arcs_34_1[1] = { {22, 2}, }; -static arc arcs_38_2[2] = { +static arc arcs_34_2[2] = { {28, 3}, {0, 2}, }; -static arc arcs_38_3[1] = { +static arc arcs_34_3[1] = { {22, 4}, }; -static arc arcs_38_4[1] = { +static arc arcs_34_4[1] = { {0, 4}, }; -static state states_38[5] = { - {1, arcs_38_0}, - {1, arcs_38_1}, - {2, arcs_38_2}, - {1, arcs_38_3}, - {1, arcs_38_4}, +static state states_34[5] = { + {1, arcs_34_0}, + {1, arcs_34_1}, + {2, arcs_34_2}, + {1, arcs_34_3}, + {1, arcs_34_4}, }; -static arc arcs_39_0[7] = { +static arc arcs_35_0[7] = { + {82, 1}, + {83, 1}, + {84, 1}, + {85, 1}, {86, 1}, - {87, 1}, - {88, 1}, - {89, 1}, - {90, 1}, {17, 1}, - {91, 1}, + {87, 1}, }; -static arc arcs_39_1[1] = { +static arc arcs_35_1[1] = { {0, 1}, }; -static state states_39[2] = { - {7, arcs_39_0}, - {1, arcs_39_1}, +static state states_35[2] = { + {7, arcs_35_0}, + {1, arcs_35_1}, }; -static arc arcs_40_0[1] = { - {92, 1}, +static arc arcs_36_0[1] = { + {88, 1}, }; -static arc arcs_40_1[1] = { +static arc arcs_36_1[1] = { {22, 2}, }; -static arc arcs_40_2[1] = { +static arc arcs_36_2[1] = { {23, 3}, }; -static arc arcs_40_3[1] = { +static arc arcs_36_3[1] = { {24, 4}, }; -static arc arcs_40_4[3] = { - {93, 1}, - {94, 5}, +static arc arcs_36_4[3] = { + {89, 1}, + {90, 5}, {0, 4}, }; -static arc arcs_40_5[1] = { +static arc arcs_36_5[1] = { {23, 6}, }; -static arc arcs_40_6[1] = { +static arc arcs_36_6[1] = { {24, 7}, }; -static arc arcs_40_7[1] = { +static arc arcs_36_7[1] = { {0, 7}, }; -static state states_40[8] = { - {1, arcs_40_0}, - {1, arcs_40_1}, - {1, arcs_40_2}, - {1, arcs_40_3}, - {3, arcs_40_4}, - {1, arcs_40_5}, - {1, arcs_40_6}, - {1, arcs_40_7}, +static state states_36[8] = { + {1, arcs_36_0}, + {1, arcs_36_1}, + {1, arcs_36_2}, + {1, arcs_36_3}, + {3, arcs_36_4}, + {1, arcs_36_5}, + {1, arcs_36_6}, + {1, arcs_36_7}, }; -static arc arcs_41_0[1] = { - {95, 1}, +static arc arcs_37_0[1] = { + {91, 1}, }; -static arc arcs_41_1[1] = { +static arc arcs_37_1[1] = { {22, 2}, }; -static arc arcs_41_2[1] = { +static arc arcs_37_2[1] = { {23, 3}, }; -static arc arcs_41_3[1] = { +static arc arcs_37_3[1] = { {24, 4}, }; -static arc arcs_41_4[2] = { - {94, 5}, +static arc arcs_37_4[2] = { + {90, 5}, {0, 4}, }; -static arc arcs_41_5[1] = { +static arc arcs_37_5[1] = { {23, 6}, }; -static arc arcs_41_6[1] = { +static arc arcs_37_6[1] = { {24, 7}, }; -static arc arcs_41_7[1] = { +static arc arcs_37_7[1] = { {0, 7}, }; -static state states_41[8] = { - {1, arcs_41_0}, - {1, arcs_41_1}, - {1, arcs_41_2}, - {1, arcs_41_3}, - {2, arcs_41_4}, - {1, arcs_41_5}, - {1, arcs_41_6}, - {1, arcs_41_7}, +static state states_37[8] = { + {1, arcs_37_0}, + {1, arcs_37_1}, + {1, arcs_37_2}, + {1, arcs_37_3}, + {2, arcs_37_4}, + {1, arcs_37_5}, + {1, arcs_37_6}, + {1, arcs_37_7}, }; -static arc arcs_42_0[1] = { - {96, 1}, +static arc arcs_38_0[1] = { + {92, 1}, }; -static arc arcs_42_1[1] = { - {62, 2}, +static arc arcs_38_1[1] = { + {58, 2}, }; -static arc arcs_42_2[1] = { - {97, 3}, +static arc arcs_38_2[1] = { + {93, 3}, }; -static arc arcs_42_3[1] = { +static arc arcs_38_3[1] = { {9, 4}, }; -static arc arcs_42_4[1] = { +static arc arcs_38_4[1] = { {23, 5}, }; -static arc arcs_42_5[1] = { +static arc arcs_38_5[1] = { {24, 6}, }; -static arc arcs_42_6[2] = { - {94, 7}, +static arc arcs_38_6[2] = { + {90, 7}, {0, 6}, }; -static arc arcs_42_7[1] = { +static arc arcs_38_7[1] = { {23, 8}, }; -static arc arcs_42_8[1] = { +static arc arcs_38_8[1] = { {24, 9}, }; -static arc arcs_42_9[1] = { +static arc arcs_38_9[1] = { {0, 9}, }; -static state states_42[10] = { - {1, arcs_42_0}, - {1, arcs_42_1}, - {1, arcs_42_2}, - {1, arcs_42_3}, - {1, arcs_42_4}, - {1, arcs_42_5}, - {2, arcs_42_6}, - {1, arcs_42_7}, - {1, arcs_42_8}, - {1, arcs_42_9}, +static state states_38[10] = { + {1, arcs_38_0}, + {1, arcs_38_1}, + {1, arcs_38_2}, + {1, arcs_38_3}, + {1, arcs_38_4}, + {1, arcs_38_5}, + {2, arcs_38_6}, + {1, arcs_38_7}, + {1, arcs_38_8}, + {1, arcs_38_9}, }; -static arc arcs_43_0[1] = { - {98, 1}, +static arc arcs_39_0[1] = { + {94, 1}, }; -static arc arcs_43_1[1] = { +static arc arcs_39_1[1] = { {23, 2}, }; -static arc arcs_43_2[1] = { +static arc arcs_39_2[1] = { {24, 3}, }; -static arc arcs_43_3[2] = { - {99, 4}, - {100, 5}, +static arc arcs_39_3[2] = { + {95, 4}, + {96, 5}, }; -static arc arcs_43_4[1] = { +static arc arcs_39_4[1] = { {23, 6}, }; -static arc arcs_43_5[1] = { +static arc arcs_39_5[1] = { {23, 7}, }; -static arc arcs_43_6[1] = { +static arc arcs_39_6[1] = { {24, 8}, }; -static arc arcs_43_7[1] = { +static arc arcs_39_7[1] = { {24, 9}, }; -static arc arcs_43_8[4] = { - {99, 4}, - {94, 10}, - {100, 5}, +static arc arcs_39_8[4] = { + {95, 4}, + {90, 10}, + {96, 5}, {0, 8}, }; -static arc arcs_43_9[1] = { +static arc arcs_39_9[1] = { {0, 9}, }; -static arc arcs_43_10[1] = { +static arc arcs_39_10[1] = { {23, 11}, }; -static arc arcs_43_11[1] = { +static arc arcs_39_11[1] = { {24, 12}, }; -static arc arcs_43_12[2] = { - {100, 5}, +static arc arcs_39_12[2] = { + {96, 5}, {0, 12}, }; -static state states_43[13] = { - {1, arcs_43_0}, - {1, arcs_43_1}, - {1, arcs_43_2}, - {2, arcs_43_3}, - {1, arcs_43_4}, - {1, arcs_43_5}, - {1, arcs_43_6}, - {1, arcs_43_7}, - {4, arcs_43_8}, - {1, arcs_43_9}, - {1, arcs_43_10}, - {1, arcs_43_11}, - {2, arcs_43_12}, +static state states_39[13] = { + {1, arcs_39_0}, + {1, arcs_39_1}, + {1, arcs_39_2}, + {2, arcs_39_3}, + {1, arcs_39_4}, + {1, arcs_39_5}, + {1, arcs_39_6}, + {1, arcs_39_7}, + {4, arcs_39_8}, + {1, arcs_39_9}, + {1, arcs_39_10}, + {1, arcs_39_11}, + {2, arcs_39_12}, }; -static arc arcs_44_0[1] = { - {101, 1}, +static arc arcs_40_0[1] = { + {97, 1}, }; -static arc arcs_44_1[1] = { +static arc arcs_40_1[1] = { {22, 2}, }; -static arc arcs_44_2[2] = { - {102, 3}, +static arc arcs_40_2[2] = { + {98, 3}, {23, 4}, }; -static arc arcs_44_3[1] = { +static arc arcs_40_3[1] = { {23, 4}, }; -static arc arcs_44_4[1] = { +static arc arcs_40_4[1] = { {24, 5}, }; -static arc arcs_44_5[1] = { +static arc arcs_40_5[1] = { {0, 5}, }; -static state states_44[6] = { - {1, arcs_44_0}, - {1, arcs_44_1}, - {2, arcs_44_2}, - {1, arcs_44_3}, - {1, arcs_44_4}, - {1, arcs_44_5}, +static state states_40[6] = { + {1, arcs_40_0}, + {1, arcs_40_1}, + {2, arcs_40_2}, + {1, arcs_40_3}, + {1, arcs_40_4}, + {1, arcs_40_5}, }; -static arc arcs_45_0[1] = { - {81, 1}, +static arc arcs_41_0[1] = { + {77, 1}, }; -static arc arcs_45_1[1] = { - {103, 2}, +static arc arcs_41_1[1] = { + {99, 2}, }; -static arc arcs_45_2[1] = { +static arc arcs_41_2[1] = { {0, 2}, }; -static state states_45[3] = { - {1, arcs_45_0}, - {1, arcs_45_1}, - {1, arcs_45_2}, +static state states_41[3] = { + {1, arcs_41_0}, + {1, arcs_41_1}, + {1, arcs_41_2}, }; -static arc arcs_46_0[1] = { - {104, 1}, +static arc arcs_42_0[1] = { + {100, 1}, }; -static arc arcs_46_1[2] = { +static arc arcs_42_1[2] = { {22, 2}, {0, 1}, }; -static arc arcs_46_2[2] = { - {81, 3}, +static arc arcs_42_2[2] = { + {77, 3}, {0, 2}, }; -static arc arcs_46_3[1] = { +static arc arcs_42_3[1] = { {19, 4}, }; -static arc arcs_46_4[1] = { +static arc arcs_42_4[1] = { {0, 4}, }; -static state states_46[5] = { - {1, arcs_46_0}, - {2, arcs_46_1}, - {2, arcs_46_2}, - {1, arcs_46_3}, - {1, arcs_46_4}, +static state states_42[5] = { + {1, arcs_42_0}, + {2, arcs_42_1}, + {2, arcs_42_2}, + {1, arcs_42_3}, + {1, arcs_42_4}, }; -static arc arcs_47_0[2] = { +static arc arcs_43_0[2] = { {3, 1}, {2, 2}, }; -static arc arcs_47_1[1] = { +static arc arcs_43_1[1] = { {0, 1}, }; -static arc arcs_47_2[1] = { - {105, 3}, +static arc arcs_43_2[1] = { + {101, 3}, }; -static arc arcs_47_3[1] = { +static arc arcs_43_3[1] = { {6, 4}, }; -static arc arcs_47_4[2] = { +static arc arcs_43_4[2] = { {6, 4}, - {106, 1}, + {102, 1}, }; -static state states_47[5] = { - {2, arcs_47_0}, - {1, arcs_47_1}, - {1, arcs_47_2}, - {1, arcs_47_3}, - {2, arcs_47_4}, +static state states_43[5] = { + {2, arcs_43_0}, + {1, arcs_43_1}, + {1, arcs_43_2}, + {1, arcs_43_3}, + {2, arcs_43_4}, }; -static arc arcs_48_0[1] = { - {108, 1}, +static arc arcs_44_0[1] = { + {104, 1}, }; -static arc arcs_48_1[2] = { +static arc arcs_44_1[2] = { {28, 2}, {0, 1}, }; -static arc arcs_48_2[1] = { - {108, 3}, +static arc arcs_44_2[1] = { + {104, 3}, }; -static arc arcs_48_3[2] = { +static arc arcs_44_3[2] = { {28, 4}, {0, 3}, }; -static arc arcs_48_4[2] = { - {108, 3}, +static arc arcs_44_4[2] = { + {104, 3}, {0, 4}, }; -static state states_48[5] = { - {1, arcs_48_0}, - {2, arcs_48_1}, - {1, arcs_48_2}, - {2, arcs_48_3}, - {2, arcs_48_4}, +static state states_44[5] = { + {1, arcs_44_0}, + {2, arcs_44_1}, + {1, arcs_44_2}, + {2, arcs_44_3}, + {2, arcs_44_4}, }; -static arc arcs_49_0[2] = { - {109, 1}, - {110, 1}, +static arc arcs_45_0[2] = { + {105, 1}, + {106, 1}, }; -static arc arcs_49_1[1] = { +static arc arcs_45_1[1] = { {0, 1}, }; -static state states_49[2] = { - {2, arcs_49_0}, - {1, arcs_49_1}, +static state states_45[2] = { + {2, arcs_45_0}, + {1, arcs_45_1}, }; -static arc arcs_50_0[1] = { - {111, 1}, +static arc arcs_46_0[1] = { + {107, 1}, }; -static arc arcs_50_1[2] = { - {33, 2}, +static arc arcs_46_1[2] = { + {31, 2}, {23, 3}, }; -static arc arcs_50_2[1] = { +static arc arcs_46_2[1] = { {23, 3}, }; -static arc arcs_50_3[1] = { - {108, 4}, +static arc arcs_46_3[1] = { + {104, 4}, }; -static arc arcs_50_4[1] = { +static arc arcs_46_4[1] = { {0, 4}, }; -static state states_50[5] = { - {1, arcs_50_0}, - {2, arcs_50_1}, - {1, arcs_50_2}, - {1, arcs_50_3}, - {1, arcs_50_4}, +static state states_46[5] = { + {1, arcs_46_0}, + {2, arcs_46_1}, + {1, arcs_46_2}, + {1, arcs_46_3}, + {1, arcs_46_4}, }; -static arc arcs_51_0[2] = { - {109, 1}, - {112, 2}, +static arc arcs_47_0[2] = { + {105, 1}, + {108, 2}, }; -static arc arcs_51_1[2] = { - {92, 3}, +static arc arcs_47_1[2] = { + {88, 3}, {0, 1}, }; -static arc arcs_51_2[1] = { +static arc arcs_47_2[1] = { {0, 2}, }; -static arc arcs_51_3[1] = { - {109, 4}, +static arc arcs_47_3[1] = { + {105, 4}, }; -static arc arcs_51_4[1] = { - {94, 5}, +static arc arcs_47_4[1] = { + {90, 5}, }; -static arc arcs_51_5[1] = { +static arc arcs_47_5[1] = { {22, 2}, }; -static state states_51[6] = { - {2, arcs_51_0}, - {2, arcs_51_1}, - {1, arcs_51_2}, - {1, arcs_51_3}, - {1, arcs_51_4}, - {1, arcs_51_5}, +static state states_47[6] = { + {2, arcs_47_0}, + {2, arcs_47_1}, + {1, arcs_47_2}, + {1, arcs_47_3}, + {1, arcs_47_4}, + {1, arcs_47_5}, }; -static arc arcs_52_0[1] = { - {113, 1}, +static arc arcs_48_0[1] = { + {109, 1}, }; -static arc arcs_52_1[2] = { - {114, 0}, +static arc arcs_48_1[2] = { + {110, 0}, {0, 1}, }; -static state states_52[2] = { - {1, arcs_52_0}, - {2, arcs_52_1}, +static state states_48[2] = { + {1, arcs_48_0}, + {2, arcs_48_1}, }; -static arc arcs_53_0[1] = { - {115, 1}, +static arc arcs_49_0[1] = { + {111, 1}, }; -static arc arcs_53_1[2] = { - {116, 0}, +static arc arcs_49_1[2] = { + {112, 0}, {0, 1}, }; -static state states_53[2] = { - {1, arcs_53_0}, - {2, arcs_53_1}, +static state states_49[2] = { + {1, arcs_49_0}, + {2, arcs_49_1}, }; -static arc arcs_54_0[2] = { - {117, 1}, - {118, 2}, +static arc arcs_50_0[2] = { + {113, 1}, + {114, 2}, }; -static arc arcs_54_1[1] = { - {115, 2}, +static arc arcs_50_1[1] = { + {111, 2}, }; -static arc arcs_54_2[1] = { +static arc arcs_50_2[1] = { {0, 2}, }; -static state states_54[3] = { - {2, arcs_54_0}, - {1, arcs_54_1}, - {1, arcs_54_2}, +static state states_50[3] = { + {2, arcs_50_0}, + {1, arcs_50_1}, + {1, arcs_50_2}, }; -static arc arcs_55_0[1] = { - {103, 1}, +static arc arcs_51_0[1] = { + {99, 1}, }; -static arc arcs_55_1[2] = { - {119, 0}, +static arc arcs_51_1[2] = { + {115, 0}, {0, 1}, }; -static state states_55[2] = { - {1, arcs_55_0}, - {2, arcs_55_1}, +static state states_51[2] = { + {1, arcs_51_0}, + {2, arcs_51_1}, }; -static arc arcs_56_0[9] = { +static arc arcs_52_0[9] = { + {116, 1}, + {117, 1}, + {118, 1}, + {119, 1}, {120, 1}, {121, 1}, - {122, 1}, - {123, 1}, - {124, 1}, - {125, 1}, - {97, 1}, - {117, 2}, - {126, 3}, + {93, 1}, + {113, 2}, + {122, 3}, }; -static arc arcs_56_1[1] = { +static arc arcs_52_1[1] = { {0, 1}, }; -static arc arcs_56_2[1] = { - {97, 1}, +static arc arcs_52_2[1] = { + {93, 1}, }; -static arc arcs_56_3[2] = { - {117, 1}, +static arc arcs_52_3[2] = { + {113, 1}, {0, 3}, }; -static state states_56[4] = { - {9, arcs_56_0}, - {1, arcs_56_1}, - {1, arcs_56_2}, - {2, arcs_56_3}, +static state states_52[4] = { + {9, arcs_52_0}, + {1, arcs_52_1}, + {1, arcs_52_2}, + {2, arcs_52_3}, }; -static arc arcs_57_0[1] = { - {127, 1}, +static arc arcs_53_0[1] = { + {123, 1}, }; -static arc arcs_57_1[2] = { - {128, 0}, +static arc arcs_53_1[2] = { + {124, 0}, {0, 1}, }; -static state states_57[2] = { - {1, arcs_57_0}, - {2, arcs_57_1}, +static state states_53[2] = { + {1, arcs_53_0}, + {2, arcs_53_1}, }; -static arc arcs_58_0[1] = { - {129, 1}, +static arc arcs_54_0[1] = { + {125, 1}, }; -static arc arcs_58_1[2] = { - {130, 0}, +static arc arcs_54_1[2] = { + {126, 0}, {0, 1}, }; -static state states_58[2] = { - {1, arcs_58_0}, - {2, arcs_58_1}, +static state states_54[2] = { + {1, arcs_54_0}, + {2, arcs_54_1}, }; -static arc arcs_59_0[1] = { - {131, 1}, +static arc arcs_55_0[1] = { + {127, 1}, }; -static arc arcs_59_1[2] = { - {132, 0}, +static arc arcs_55_1[2] = { + {128, 0}, {0, 1}, }; -static state states_59[2] = { - {1, arcs_59_0}, - {2, arcs_59_1}, +static state states_55[2] = { + {1, arcs_55_0}, + {2, arcs_55_1}, }; -static arc arcs_60_0[1] = { - {133, 1}, +static arc arcs_56_0[1] = { + {129, 1}, }; -static arc arcs_60_1[3] = { - {134, 0}, - {135, 0}, +static arc arcs_56_1[3] = { + {130, 0}, + {131, 0}, {0, 1}, }; -static state states_60[2] = { - {1, arcs_60_0}, - {3, arcs_60_1}, +static state states_56[2] = { + {1, arcs_56_0}, + {3, arcs_56_1}, }; -static arc arcs_61_0[1] = { - {136, 1}, +static arc arcs_57_0[1] = { + {132, 1}, }; -static arc arcs_61_1[3] = { - {137, 0}, - {138, 0}, +static arc arcs_57_1[3] = { + {133, 0}, + {134, 0}, {0, 1}, }; -static state states_61[2] = { - {1, arcs_61_0}, - {3, arcs_61_1}, +static state states_57[2] = { + {1, arcs_57_0}, + {3, arcs_57_1}, }; -static arc arcs_62_0[1] = { - {139, 1}, +static arc arcs_58_0[1] = { + {135, 1}, }; -static arc arcs_62_1[5] = { +static arc arcs_58_1[5] = { {29, 0}, - {140, 0}, - {141, 0}, - {142, 0}, + {136, 0}, + {137, 0}, + {138, 0}, {0, 1}, }; -static state states_62[2] = { - {1, arcs_62_0}, - {5, arcs_62_1}, +static state states_58[2] = { + {1, arcs_58_0}, + {5, arcs_58_1}, }; -static arc arcs_63_0[4] = { - {137, 1}, - {138, 1}, - {143, 1}, - {144, 2}, +static arc arcs_59_0[4] = { + {133, 1}, + {134, 1}, + {139, 1}, + {140, 2}, }; -static arc arcs_63_1[1] = { - {139, 2}, +static arc arcs_59_1[1] = { + {135, 2}, }; -static arc arcs_63_2[1] = { +static arc arcs_59_2[1] = { {0, 2}, }; -static state states_63[3] = { - {4, arcs_63_0}, - {1, arcs_63_1}, - {1, arcs_63_2}, +static state states_59[3] = { + {4, arcs_59_0}, + {1, arcs_59_1}, + {1, arcs_59_2}, }; -static arc arcs_64_0[1] = { - {145, 1}, +static arc arcs_60_0[1] = { + {141, 1}, }; -static arc arcs_64_1[3] = { - {146, 1}, - {31, 2}, +static arc arcs_60_1[3] = { + {142, 1}, + {30, 2}, {0, 1}, }; -static arc arcs_64_2[1] = { - {139, 3}, +static arc arcs_60_2[1] = { + {135, 3}, }; -static arc arcs_64_3[1] = { +static arc arcs_60_3[1] = { {0, 3}, }; -static state states_64[4] = { - {1, arcs_64_0}, - {3, arcs_64_1}, - {1, arcs_64_2}, - {1, arcs_64_3}, +static state states_60[4] = { + {1, arcs_60_0}, + {3, arcs_60_1}, + {1, arcs_60_2}, + {1, arcs_60_3}, }; -static arc arcs_65_0[7] = { +static arc arcs_61_0[7] = { {13, 1}, - {148, 2}, - {151, 3}, + {144, 2}, + {147, 3}, {19, 4}, - {154, 4}, - {155, 5}, - {78, 6}, + {150, 4}, + {151, 5}, + {74, 6}, }; -static arc arcs_65_1[3] = { - {48, 7}, - {147, 7}, +static arc arcs_61_1[3] = { + {44, 7}, + {143, 7}, {15, 4}, }; -static arc arcs_65_2[2] = { - {149, 8}, - {150, 4}, +static arc arcs_61_2[2] = { + {145, 8}, + {146, 4}, }; -static arc arcs_65_3[2] = { - {152, 9}, - {153, 4}, +static arc arcs_61_3[2] = { + {148, 9}, + {149, 4}, }; -static arc arcs_65_4[1] = { +static arc arcs_61_4[1] = { {0, 4}, }; -static arc arcs_65_5[2] = { - {155, 5}, +static arc arcs_61_5[2] = { + {151, 5}, {0, 5}, }; -static arc arcs_65_6[1] = { - {78, 10}, +static arc arcs_61_6[1] = { + {74, 10}, }; -static arc arcs_65_7[1] = { +static arc arcs_61_7[1] = { {15, 4}, }; -static arc arcs_65_8[1] = { - {150, 4}, +static arc arcs_61_8[1] = { + {146, 4}, }; -static arc arcs_65_9[1] = { - {153, 4}, +static arc arcs_61_9[1] = { + {149, 4}, }; -static arc arcs_65_10[1] = { - {78, 4}, +static arc arcs_61_10[1] = { + {74, 4}, }; -static state states_65[11] = { - {7, arcs_65_0}, - {3, arcs_65_1}, - {2, arcs_65_2}, - {2, arcs_65_3}, - {1, arcs_65_4}, - {2, arcs_65_5}, - {1, arcs_65_6}, - {1, arcs_65_7}, - {1, arcs_65_8}, - {1, arcs_65_9}, - {1, arcs_65_10}, +static state states_61[11] = { + {7, arcs_61_0}, + {3, arcs_61_1}, + {2, arcs_61_2}, + {2, arcs_61_3}, + {1, arcs_61_4}, + {2, arcs_61_5}, + {1, arcs_61_6}, + {1, arcs_61_7}, + {1, arcs_61_8}, + {1, arcs_61_9}, + {1, arcs_61_10}, }; -static arc arcs_66_0[1] = { +static arc arcs_62_0[1] = { {22, 1}, }; -static arc arcs_66_1[3] = { - {156, 2}, +static arc arcs_62_1[3] = { + {152, 2}, {28, 3}, {0, 1}, }; -static arc arcs_66_2[1] = { +static arc arcs_62_2[1] = { {0, 2}, }; -static arc arcs_66_3[2] = { +static arc arcs_62_3[2] = { {22, 4}, {0, 3}, }; -static arc arcs_66_4[2] = { +static arc arcs_62_4[2] = { {28, 3}, {0, 4}, }; -static state states_66[5] = { - {1, arcs_66_0}, - {3, arcs_66_1}, - {1, arcs_66_2}, - {2, arcs_66_3}, - {2, arcs_66_4}, +static state states_62[5] = { + {1, arcs_62_0}, + {3, arcs_62_1}, + {1, arcs_62_2}, + {2, arcs_62_3}, + {2, arcs_62_4}, }; -static arc arcs_67_0[1] = { +static arc arcs_63_0[1] = { {22, 1}, }; -static arc arcs_67_1[3] = { - {157, 2}, +static arc arcs_63_1[3] = { + {153, 2}, {28, 3}, {0, 1}, }; -static arc arcs_67_2[1] = { +static arc arcs_63_2[1] = { {0, 2}, }; -static arc arcs_67_3[2] = { +static arc arcs_63_3[2] = { {22, 4}, {0, 3}, }; -static arc arcs_67_4[2] = { +static arc arcs_63_4[2] = { {28, 3}, {0, 4}, }; -static state states_67[5] = { - {1, arcs_67_0}, - {3, arcs_67_1}, - {1, arcs_67_2}, - {2, arcs_67_3}, - {2, arcs_67_4}, +static state states_63[5] = { + {1, arcs_63_0}, + {3, arcs_63_1}, + {1, arcs_63_2}, + {2, arcs_63_3}, + {2, arcs_63_4}, }; -static arc arcs_68_0[1] = { - {111, 1}, +static arc arcs_64_0[1] = { + {107, 1}, }; -static arc arcs_68_1[2] = { - {33, 2}, +static arc arcs_64_1[2] = { + {31, 2}, {23, 3}, }; -static arc arcs_68_2[1] = { +static arc arcs_64_2[1] = { {23, 3}, }; -static arc arcs_68_3[1] = { +static arc arcs_64_3[1] = { {22, 4}, }; -static arc arcs_68_4[1] = { +static arc arcs_64_4[1] = { {0, 4}, }; -static state states_68[5] = { - {1, arcs_68_0}, - {2, arcs_68_1}, - {1, arcs_68_2}, - {1, arcs_68_3}, - {1, arcs_68_4}, +static state states_64[5] = { + {1, arcs_64_0}, + {2, arcs_64_1}, + {1, arcs_64_2}, + {1, arcs_64_3}, + {1, arcs_64_4}, }; -static arc arcs_69_0[3] = { +static arc arcs_65_0[3] = { {13, 1}, - {148, 2}, - {78, 3}, + {144, 2}, + {74, 3}, }; -static arc arcs_69_1[2] = { +static arc arcs_65_1[2] = { {14, 4}, {15, 5}, }; -static arc arcs_69_2[1] = { - {158, 6}, +static arc arcs_65_2[1] = { + {154, 6}, }; -static arc arcs_69_3[1] = { +static arc arcs_65_3[1] = { {19, 5}, }; -static arc arcs_69_4[1] = { +static arc arcs_65_4[1] = { {15, 5}, }; -static arc arcs_69_5[1] = { +static arc arcs_65_5[1] = { {0, 5}, }; -static arc arcs_69_6[1] = { - {150, 5}, +static arc arcs_65_6[1] = { + {146, 5}, }; -static state states_69[7] = { - {3, arcs_69_0}, - {2, arcs_69_1}, - {1, arcs_69_2}, - {1, arcs_69_3}, - {1, arcs_69_4}, - {1, arcs_69_5}, - {1, arcs_69_6}, +static state states_65[7] = { + {3, arcs_65_0}, + {2, arcs_65_1}, + {1, arcs_65_2}, + {1, arcs_65_3}, + {1, arcs_65_4}, + {1, arcs_65_5}, + {1, arcs_65_6}, }; -static arc arcs_70_0[1] = { - {159, 1}, +static arc arcs_66_0[1] = { + {155, 1}, }; -static arc arcs_70_1[2] = { +static arc arcs_66_1[2] = { {28, 2}, {0, 1}, }; -static arc arcs_70_2[2] = { - {159, 1}, +static arc arcs_66_2[2] = { + {155, 1}, {0, 2}, }; -static state states_70[3] = { - {1, arcs_70_0}, - {2, arcs_70_1}, - {2, arcs_70_2}, +static state states_66[3] = { + {1, arcs_66_0}, + {2, arcs_66_1}, + {2, arcs_66_2}, }; -static arc arcs_71_0[2] = { +static arc arcs_67_0[2] = { {22, 1}, {23, 2}, }; -static arc arcs_71_1[2] = { +static arc arcs_67_1[2] = { {23, 2}, {0, 1}, }; -static arc arcs_71_2[3] = { +static arc arcs_67_2[3] = { {22, 3}, - {160, 4}, + {156, 4}, {0, 2}, }; -static arc arcs_71_3[2] = { - {160, 4}, +static arc arcs_67_3[2] = { + {156, 4}, {0, 3}, }; -static arc arcs_71_4[1] = { +static arc arcs_67_4[1] = { {0, 4}, }; -static state states_71[5] = { - {2, arcs_71_0}, - {2, arcs_71_1}, - {3, arcs_71_2}, - {2, arcs_71_3}, - {1, arcs_71_4}, +static state states_67[5] = { + {2, arcs_67_0}, + {2, arcs_67_1}, + {3, arcs_67_2}, + {2, arcs_67_3}, + {1, arcs_67_4}, }; -static arc arcs_72_0[1] = { +static arc arcs_68_0[1] = { {23, 1}, }; -static arc arcs_72_1[2] = { +static arc arcs_68_1[2] = { {22, 2}, {0, 1}, }; -static arc arcs_72_2[1] = { +static arc arcs_68_2[1] = { {0, 2}, }; -static state states_72[3] = { - {1, arcs_72_0}, - {2, arcs_72_1}, - {1, arcs_72_2}, +static state states_68[3] = { + {1, arcs_68_0}, + {2, arcs_68_1}, + {1, arcs_68_2}, }; -static arc arcs_73_0[1] = { - {103, 1}, +static arc arcs_69_0[1] = { + {99, 1}, }; -static arc arcs_73_1[2] = { +static arc arcs_69_1[2] = { {28, 2}, {0, 1}, }; -static arc arcs_73_2[2] = { - {103, 1}, +static arc arcs_69_2[2] = { + {99, 1}, {0, 2}, }; -static state states_73[3] = { - {1, arcs_73_0}, - {2, arcs_73_1}, - {2, arcs_73_2}, +static state states_69[3] = { + {1, arcs_69_0}, + {2, arcs_69_1}, + {2, arcs_69_2}, }; -static arc arcs_74_0[1] = { +static arc arcs_70_0[1] = { {22, 1}, }; -static arc arcs_74_1[2] = { +static arc arcs_70_1[2] = { {28, 2}, {0, 1}, }; -static arc arcs_74_2[2] = { +static arc arcs_70_2[2] = { {22, 1}, {0, 2}, }; -static state states_74[3] = { - {1, arcs_74_0}, - {2, arcs_74_1}, - {2, arcs_74_2}, +static state states_70[3] = { + {1, arcs_70_0}, + {2, arcs_70_1}, + {2, arcs_70_2}, }; -static arc arcs_75_0[1] = { +static arc arcs_71_0[1] = { {22, 1}, }; -static arc arcs_75_1[3] = { +static arc arcs_71_1[3] = { {23, 2}, {28, 3}, {0, 1}, }; -static arc arcs_75_2[1] = { +static arc arcs_71_2[1] = { {22, 4}, }; -static arc arcs_75_3[2] = { +static arc arcs_71_3[2] = { {22, 5}, {0, 3}, }; -static arc arcs_75_4[2] = { +static arc arcs_71_4[2] = { {28, 6}, {0, 4}, }; -static arc arcs_75_5[2] = { +static arc arcs_71_5[2] = { {28, 3}, {0, 5}, }; -static arc arcs_75_6[2] = { +static arc arcs_71_6[2] = { {22, 7}, {0, 6}, }; -static arc arcs_75_7[1] = { +static arc arcs_71_7[1] = { {23, 2}, }; -static state states_75[8] = { - {1, arcs_75_0}, - {3, arcs_75_1}, - {1, arcs_75_2}, - {2, arcs_75_3}, - {2, arcs_75_4}, - {2, arcs_75_5}, - {2, arcs_75_6}, - {1, arcs_75_7}, +static state states_71[8] = { + {1, arcs_71_0}, + {3, arcs_71_1}, + {1, arcs_71_2}, + {2, arcs_71_3}, + {2, arcs_71_4}, + {2, arcs_71_5}, + {2, arcs_71_6}, + {1, arcs_71_7}, }; -static arc arcs_76_0[1] = { - {161, 1}, +static arc arcs_72_0[1] = { + {157, 1}, }; -static arc arcs_76_1[1] = { +static arc arcs_72_1[1] = { {19, 2}, }; -static arc arcs_76_2[2] = { +static arc arcs_72_2[2] = { {13, 3}, {23, 4}, }; -static arc arcs_76_3[2] = { +static arc arcs_72_3[2] = { {9, 5}, {15, 6}, }; -static arc arcs_76_4[1] = { +static arc arcs_72_4[1] = { {24, 7}, }; -static arc arcs_76_5[1] = { +static arc arcs_72_5[1] = { {15, 6}, }; -static arc arcs_76_6[1] = { +static arc arcs_72_6[1] = { {23, 4}, }; -static arc arcs_76_7[1] = { +static arc arcs_72_7[1] = { {0, 7}, }; -static state states_76[8] = { - {1, arcs_76_0}, - {1, arcs_76_1}, - {2, arcs_76_2}, - {2, arcs_76_3}, - {1, arcs_76_4}, - {1, arcs_76_5}, - {1, arcs_76_6}, - {1, arcs_76_7}, +static state states_72[8] = { + {1, arcs_72_0}, + {1, arcs_72_1}, + {2, arcs_72_2}, + {2, arcs_72_3}, + {1, arcs_72_4}, + {1, arcs_72_5}, + {1, arcs_72_6}, + {1, arcs_72_7}, }; -static arc arcs_77_0[3] = { - {162, 1}, +static arc arcs_73_0[3] = { + {158, 1}, {29, 2}, - {31, 3}, + {30, 3}, }; -static arc arcs_77_1[2] = { +static arc arcs_73_1[2] = { {28, 4}, {0, 1}, }; -static arc arcs_77_2[1] = { +static arc arcs_73_2[1] = { {22, 5}, }; -static arc arcs_77_3[1] = { +static arc arcs_73_3[1] = { {22, 6}, }; -static arc arcs_77_4[4] = { - {162, 1}, +static arc arcs_73_4[4] = { + {158, 1}, {29, 2}, - {31, 3}, + {30, 3}, {0, 4}, }; -static arc arcs_77_5[2] = { +static arc arcs_73_5[2] = { {28, 7}, {0, 5}, }; -static arc arcs_77_6[1] = { +static arc arcs_73_6[1] = { {0, 6}, }; -static arc arcs_77_7[1] = { - {31, 3}, +static arc arcs_73_7[1] = { + {30, 3}, }; -static state states_77[8] = { - {3, arcs_77_0}, - {2, arcs_77_1}, - {1, arcs_77_2}, - {1, arcs_77_3}, - {4, arcs_77_4}, - {2, arcs_77_5}, - {1, arcs_77_6}, - {1, arcs_77_7}, +static state states_73[8] = { + {3, arcs_73_0}, + {2, arcs_73_1}, + {1, arcs_73_2}, + {1, arcs_73_3}, + {4, arcs_73_4}, + {2, arcs_73_5}, + {1, arcs_73_6}, + {1, arcs_73_7}, }; -static arc arcs_78_0[1] = { +static arc arcs_74_0[1] = { {22, 1}, }; -static arc arcs_78_1[3] = { - {157, 2}, +static arc arcs_74_1[3] = { + {153, 2}, {27, 3}, {0, 1}, }; -static arc arcs_78_2[1] = { +static arc arcs_74_2[1] = { {0, 2}, }; -static arc arcs_78_3[1] = { +static arc arcs_74_3[1] = { {22, 2}, }; -static state states_78[4] = { - {1, arcs_78_0}, - {3, arcs_78_1}, - {1, arcs_78_2}, - {1, arcs_78_3}, +static state states_74[4] = { + {1, arcs_74_0}, + {3, arcs_74_1}, + {1, arcs_74_2}, + {1, arcs_74_3}, }; -static arc arcs_79_0[2] = { - {156, 1}, - {164, 1}, +static arc arcs_75_0[2] = { + {152, 1}, + {160, 1}, }; -static arc arcs_79_1[1] = { +static arc arcs_75_1[1] = { {0, 1}, }; -static state states_79[2] = { - {2, arcs_79_0}, - {1, arcs_79_1}, +static state states_75[2] = { + {2, arcs_75_0}, + {1, arcs_75_1}, }; -static arc arcs_80_0[1] = { - {96, 1}, +static arc arcs_76_0[1] = { + {92, 1}, }; -static arc arcs_80_1[1] = { - {62, 2}, +static arc arcs_76_1[1] = { + {58, 2}, }; -static arc arcs_80_2[1] = { - {97, 3}, +static arc arcs_76_2[1] = { + {93, 3}, }; -static arc arcs_80_3[1] = { - {107, 4}, +static arc arcs_76_3[1] = { + {103, 4}, }; -static arc arcs_80_4[2] = { - {163, 5}, +static arc arcs_76_4[2] = { + {159, 5}, {0, 4}, }; -static arc arcs_80_5[1] = { +static arc arcs_76_5[1] = { {0, 5}, }; -static state states_80[6] = { - {1, arcs_80_0}, - {1, arcs_80_1}, - {1, arcs_80_2}, - {1, arcs_80_3}, - {2, arcs_80_4}, - {1, arcs_80_5}, +static state states_76[6] = { + {1, arcs_76_0}, + {1, arcs_76_1}, + {1, arcs_76_2}, + {1, arcs_76_3}, + {2, arcs_76_4}, + {1, arcs_76_5}, }; -static arc arcs_81_0[1] = { - {92, 1}, +static arc arcs_77_0[1] = { + {88, 1}, }; -static arc arcs_81_1[1] = { - {108, 2}, +static arc arcs_77_1[1] = { + {104, 2}, }; -static arc arcs_81_2[2] = { - {163, 3}, +static arc arcs_77_2[2] = { + {159, 3}, {0, 2}, }; -static arc arcs_81_3[1] = { +static arc arcs_77_3[1] = { {0, 3}, }; -static state states_81[4] = { - {1, arcs_81_0}, - {1, arcs_81_1}, - {2, arcs_81_2}, - {1, arcs_81_3}, +static state states_77[4] = { + {1, arcs_77_0}, + {1, arcs_77_1}, + {2, arcs_77_2}, + {1, arcs_77_3}, }; -static arc arcs_82_0[2] = { - {157, 1}, - {166, 1}, +static arc arcs_78_0[2] = { + {153, 1}, + {162, 1}, }; -static arc arcs_82_1[1] = { +static arc arcs_78_1[1] = { {0, 1}, }; -static state states_82[2] = { - {2, arcs_82_0}, - {1, arcs_82_1}, +static state states_78[2] = { + {2, arcs_78_0}, + {1, arcs_78_1}, }; -static arc arcs_83_0[1] = { - {96, 1}, +static arc arcs_79_0[1] = { + {92, 1}, }; -static arc arcs_83_1[1] = { - {62, 2}, +static arc arcs_79_1[1] = { + {58, 2}, }; -static arc arcs_83_2[1] = { - {97, 3}, +static arc arcs_79_2[1] = { + {93, 3}, }; -static arc arcs_83_3[1] = { - {109, 4}, +static arc arcs_79_3[1] = { + {105, 4}, }; -static arc arcs_83_4[2] = { - {165, 5}, +static arc arcs_79_4[2] = { + {161, 5}, {0, 4}, }; -static arc arcs_83_5[1] = { +static arc arcs_79_5[1] = { {0, 5}, }; -static state states_83[6] = { - {1, arcs_83_0}, - {1, arcs_83_1}, - {1, arcs_83_2}, - {1, arcs_83_3}, - {2, arcs_83_4}, - {1, arcs_83_5}, +static state states_79[6] = { + {1, arcs_79_0}, + {1, arcs_79_1}, + {1, arcs_79_2}, + {1, arcs_79_3}, + {2, arcs_79_4}, + {1, arcs_79_5}, }; -static arc arcs_84_0[1] = { - {92, 1}, +static arc arcs_80_0[1] = { + {88, 1}, }; -static arc arcs_84_1[1] = { - {108, 2}, +static arc arcs_80_1[1] = { + {104, 2}, }; -static arc arcs_84_2[2] = { - {165, 3}, +static arc arcs_80_2[2] = { + {161, 3}, {0, 2}, }; -static arc arcs_84_3[1] = { +static arc arcs_80_3[1] = { {0, 3}, }; -static state states_84[4] = { - {1, arcs_84_0}, - {1, arcs_84_1}, - {2, arcs_84_2}, - {1, arcs_84_3}, +static state states_80[4] = { + {1, arcs_80_0}, + {1, arcs_80_1}, + {2, arcs_80_2}, + {1, arcs_80_3}, }; -static arc arcs_85_0[1] = { +static arc arcs_81_0[1] = { {22, 1}, }; -static arc arcs_85_1[2] = { +static arc arcs_81_1[2] = { {28, 0}, {0, 1}, }; -static state states_85[2] = { - {1, arcs_85_0}, - {2, arcs_85_1}, +static state states_81[2] = { + {1, arcs_81_0}, + {2, arcs_81_1}, }; -static arc arcs_86_0[1] = { +static arc arcs_82_0[1] = { {19, 1}, }; -static arc arcs_86_1[1] = { +static arc arcs_82_1[1] = { {0, 1}, }; -static state states_86[2] = { - {1, arcs_86_0}, - {1, arcs_86_1}, +static state states_82[2] = { + {1, arcs_82_0}, + {1, arcs_82_1}, }; -static arc arcs_87_0[1] = { - {169, 1}, +static arc arcs_83_0[1] = { + {165, 1}, }; -static arc arcs_87_1[2] = { +static arc arcs_83_1[2] = { {9, 2}, {0, 1}, }; -static arc arcs_87_2[1] = { +static arc arcs_83_2[1] = { {0, 2}, }; -static state states_87[3] = { - {1, arcs_87_0}, - {2, arcs_87_1}, - {1, arcs_87_2}, +static state states_83[3] = { + {1, arcs_83_0}, + {2, arcs_83_1}, + {1, arcs_83_2}, }; -static dfa dfas[88] = { +static dfa dfas[84] = { {256, "single_input", 0, 3, states_0, - "\004\050\014\000\000\000\000\240\340\151\070\220\045\200\040\000\000\206\220\014\002\002"}, + "\004\050\014\000\000\000\000\012\236\206\003\131\002\010\002\000\140\010\311\040\040"}, {257, "file_input", 0, 2, states_1, - "\204\050\014\000\000\000\000\240\340\151\070\220\045\200\040\000\000\206\220\014\002\002"}, + "\204\050\014\000\000\000\000\012\236\206\003\131\002\010\002\000\140\010\311\040\040"}, {258, "eval_input", 0, 3, states_2, - "\000\040\010\000\000\000\000\000\000\100\000\000\000\200\040\000\000\206\220\014\000\000"}, + "\000\040\010\000\000\000\000\000\000\004\000\000\000\010\002\000\140\010\311\000\000"}, {259, "decorator", 0, 7, states_3, - "\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {260, "decorators", 0, 2, states_4, - "\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {261, "funcdef", 0, 9, states_5, - "\000\010\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\010\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {262, "parameters", 0, 4, states_6, - "\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {263, "typedargslist", 0, 12, states_7, - "\000\040\010\240\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {264, "tname", 0, 4, states_8, - "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {265, "tfpdef", 0, 4, states_9, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {266, "tfplist", 0, 3, states_10, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {267, "varargslist", 0, 12, states_11, - "\000\040\010\240\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {268, "vname", 0, 2, states_12, - "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {269, "vfpdef", 0, 4, states_13, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {270, "vfplist", 0, 3, states_14, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {271, "stmt", 0, 2, states_15, - "\000\050\014\000\000\000\000\240\340\151\070\220\045\200\040\000\000\206\220\014\002\002"}, - {272, "simple_stmt", 0, 4, states_16, - "\000\040\010\000\000\000\000\240\340\151\070\000\000\200\040\000\000\206\220\014\000\002"}, - {273, "small_stmt", 0, 2, states_17, - "\000\040\010\000\000\000\000\240\340\151\070\000\000\200\040\000\000\206\220\014\000\002"}, - {274, "expr_stmt", 0, 6, states_18, - "\000\040\010\000\000\000\000\000\000\100\000\000\000\200\040\000\000\206\220\014\000\000"}, - {275, "augassign", 0, 2, states_19, - "\000\000\000\000\000\000\376\037\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {276, "del_stmt", 0, 3, states_20, - "\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {277, "pass_stmt", 0, 2, states_21, - "\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {278, "flow_stmt", 0, 2, states_22, - "\000\000\000\000\000\000\000\000\340\001\000\000\000\000\000\000\000\000\000\000\000\002"}, - {279, "break_stmt", 0, 2, states_23, - "\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {280, "continue_stmt", 0, 2, states_24, - "\000\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {281, "return_stmt", 0, 3, states_25, - "\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {282, "yield_stmt", 0, 2, states_26, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\002"}, - {283, "raise_stmt", 0, 7, states_27, - "\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000"}, - {284, "import_stmt", 0, 2, states_28, - "\000\000\000\000\000\000\000\000\000\050\000\000\000\000\000\000\000\000\000\000\000\000"}, - {285, "import_name", 0, 3, states_29, - "\000\000\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000"}, - {286, "import_from", 0, 8, states_30, - "\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000"}, - {287, "import_as_name", 0, 4, states_31, - "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {288, "dotted_as_name", 0, 4, states_32, - "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {289, "import_as_names", 0, 3, states_33, - "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {290, "dotted_as_names", 0, 2, states_34, - "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {291, "dotted_name", 0, 2, states_35, - "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {292, "global_stmt", 0, 3, states_36, - "\000\000\000\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\000\000\000"}, - {293, "nonlocal_stmt", 0, 3, states_37, - "\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000\000"}, - {294, "assert_stmt", 0, 5, states_38, - "\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000"}, - {295, "compound_stmt", 0, 2, states_39, - "\000\010\004\000\000\000\000\000\000\000\000\220\045\000\000\000\000\000\000\000\002\000"}, - {296, "if_stmt", 0, 8, states_40, - "\000\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000"}, - {297, "while_stmt", 0, 8, states_41, - "\000\000\000\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000"}, - {298, "for_stmt", 0, 10, states_42, - "\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000"}, - {299, "try_stmt", 0, 13, states_43, - "\000\000\000\000\000\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000\000"}, - {300, "with_stmt", 0, 6, states_44, - "\000\000\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000"}, - {301, "with_var", 0, 3, states_45, - "\000\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000"}, - {302, "except_clause", 0, 5, states_46, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000"}, - {303, "suite", 0, 5, states_47, - "\004\040\010\000\000\000\000\240\340\151\070\000\000\200\040\000\000\206\220\014\000\002"}, - {304, "testlist_safe", 0, 5, states_48, - "\000\040\010\000\000\000\000\000\000\100\000\000\000\200\040\000\000\206\220\014\000\000"}, - {305, "old_test", 0, 2, states_49, - "\000\040\010\000\000\000\000\000\000\100\000\000\000\200\040\000\000\206\220\014\000\000"}, - {306, "old_lambdef", 0, 5, states_50, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000"}, - {307, "test", 0, 6, states_51, - "\000\040\010\000\000\000\000\000\000\100\000\000\000\200\040\000\000\206\220\014\000\000"}, - {308, "or_test", 0, 2, states_52, - "\000\040\010\000\000\000\000\000\000\100\000\000\000\000\040\000\000\206\220\014\000\000"}, - {309, "and_test", 0, 2, states_53, - "\000\040\010\000\000\000\000\000\000\100\000\000\000\000\040\000\000\206\220\014\000\000"}, - {310, "not_test", 0, 3, states_54, - "\000\040\010\000\000\000\000\000\000\100\000\000\000\000\040\000\000\206\220\014\000\000"}, - {311, "comparison", 0, 2, states_55, - "\000\040\010\000\000\000\000\000\000\100\000\000\000\000\000\000\000\206\220\014\000\000"}, - {312, "comp_op", 0, 4, states_56, - "\000\000\000\000\000\000\000\000\000\000\000\000\002\000\040\177\000\000\000\000\000\000"}, - {313, "expr", 0, 2, states_57, - "\000\040\010\000\000\000\000\000\000\100\000\000\000\000\000\000\000\206\220\014\000\000"}, - {314, "xor_expr", 0, 2, states_58, - "\000\040\010\000\000\000\000\000\000\100\000\000\000\000\000\000\000\206\220\014\000\000"}, - {315, "and_expr", 0, 2, states_59, - "\000\040\010\000\000\000\000\000\000\100\000\000\000\000\000\000\000\206\220\014\000\000"}, - {316, "shift_expr", 0, 2, states_60, - "\000\040\010\000\000\000\000\000\000\100\000\000\000\000\000\000\000\206\220\014\000\000"}, - {317, "arith_expr", 0, 2, states_61, - "\000\040\010\000\000\000\000\000\000\100\000\000\000\000\000\000\000\206\220\014\000\000"}, - {318, "term", 0, 2, states_62, - "\000\040\010\000\000\000\000\000\000\100\000\000\000\000\000\000\000\206\220\014\000\000"}, - {319, "factor", 0, 3, states_63, - "\000\040\010\000\000\000\000\000\000\100\000\000\000\000\000\000\000\206\220\014\000\000"}, - {320, "power", 0, 4, states_64, - "\000\040\010\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\220\014\000\000"}, - {321, "atom", 0, 11, states_65, - "\000\040\010\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\220\014\000\000"}, - {322, "listmaker", 0, 5, states_66, - "\000\040\010\000\000\000\000\000\000\100\000\000\000\200\040\000\000\206\220\014\000\000"}, - {323, "testlist_gexp", 0, 5, states_67, - "\000\040\010\000\000\000\000\000\000\100\000\000\000\200\040\000\000\206\220\014\000\000"}, - {324, "lambdef", 0, 5, states_68, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000"}, - {325, "trailer", 0, 7, states_69, - "\000\040\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\020\000\000\000"}, - {326, "subscriptlist", 0, 3, states_70, - "\000\040\210\000\000\000\000\000\000\100\000\000\000\200\040\000\000\206\220\014\000\000"}, - {327, "subscript", 0, 5, states_71, - "\000\040\210\000\000\000\000\000\000\100\000\000\000\200\040\000\000\206\220\014\000\000"}, - {328, "sliceop", 0, 3, states_72, - "\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {329, "exprlist", 0, 3, states_73, - "\000\040\010\000\000\000\000\000\000\100\000\000\000\000\000\000\000\206\220\014\000\000"}, - {330, "testlist", 0, 3, states_74, - "\000\040\010\000\000\000\000\000\000\100\000\000\000\200\040\000\000\206\220\014\000\000"}, - {331, "dictsetmaker", 0, 8, states_75, - "\000\040\010\000\000\000\000\000\000\100\000\000\000\200\040\000\000\206\220\014\000\000"}, - {332, "classdef", 0, 8, states_76, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\002\000"}, - {333, "arglist", 0, 8, states_77, - "\000\040\010\240\000\000\000\000\000\100\000\000\000\200\040\000\000\206\220\014\000\000"}, - {334, "argument", 0, 4, states_78, - "\000\040\010\000\000\000\000\000\000\100\000\000\000\200\040\000\000\206\220\014\000\000"}, - {335, "list_iter", 0, 2, states_79, - "\000\000\000\000\000\000\000\000\000\000\000\020\001\000\000\000\000\000\000\000\000\000"}, - {336, "list_for", 0, 6, states_80, - "\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000"}, - {337, "list_if", 0, 4, states_81, - "\000\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000"}, - {338, "gen_iter", 0, 2, states_82, - "\000\000\000\000\000\000\000\000\000\000\000\020\001\000\000\000\000\000\000\000\000\000"}, - {339, "gen_for", 0, 6, states_83, - "\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000"}, - {340, "gen_if", 0, 4, states_84, - "\000\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000"}, - {341, "testlist1", 0, 2, states_85, - "\000\040\010\000\000\000\000\000\000\100\000\000\000\200\040\000\000\206\220\014\000\000"}, - {342, "encoding_decl", 0, 2, states_86, - "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {343, "yield_expr", 0, 3, states_87, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\002"}, + "\000\000\010\140\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {264, "tfpdef", 0, 4, states_8, + "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {265, "varargslist", 0, 12, states_9, + "\000\000\010\140\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {266, "vfpdef", 0, 2, states_10, + "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {267, "stmt", 0, 2, states_11, + "\000\050\014\000\000\000\000\012\236\206\003\131\002\010\002\000\140\010\311\040\040"}, + {268, "simple_stmt", 0, 4, states_12, + "\000\040\010\000\000\000\000\012\236\206\003\000\000\010\002\000\140\010\311\000\040"}, + {269, "small_stmt", 0, 2, states_13, + "\000\040\010\000\000\000\000\012\236\206\003\000\000\010\002\000\140\010\311\000\040"}, + {270, "expr_stmt", 0, 6, states_14, + "\000\040\010\000\000\000\000\000\000\004\000\000\000\010\002\000\140\010\311\000\000"}, + {271, "augassign", 0, 2, states_15, + "\000\000\000\000\000\340\377\001\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {272, "del_stmt", 0, 3, states_16, + "\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {273, "pass_stmt", 0, 2, states_17, + "\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {274, "flow_stmt", 0, 2, states_18, + "\000\000\000\000\000\000\000\000\036\000\000\000\000\000\000\000\000\000\000\000\040"}, + {275, "break_stmt", 0, 2, states_19, + "\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000"}, + {276, "continue_stmt", 0, 2, states_20, + "\000\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000"}, + {277, "return_stmt", 0, 3, states_21, + "\000\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000"}, + {278, "yield_stmt", 0, 2, states_22, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\040"}, + {279, "raise_stmt", 0, 7, states_23, + "\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000\000\000"}, + {280, "import_stmt", 0, 2, states_24, + "\000\000\000\000\000\000\000\000\200\002\000\000\000\000\000\000\000\000\000\000\000"}, + {281, "import_name", 0, 3, states_25, + "\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000"}, + {282, "import_from", 0, 8, states_26, + "\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000"}, + {283, "import_as_name", 0, 4, states_27, + "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {284, "dotted_as_name", 0, 4, states_28, + "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {285, "import_as_names", 0, 3, states_29, + "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {286, "dotted_as_names", 0, 2, states_30, + "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {287, "dotted_name", 0, 2, states_31, + "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {288, "global_stmt", 0, 3, states_32, + "\000\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000"}, + {289, "nonlocal_stmt", 0, 3, states_33, + "\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000"}, + {290, "assert_stmt", 0, 5, states_34, + "\000\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000"}, + {291, "compound_stmt", 0, 2, states_35, + "\000\010\004\000\000\000\000\000\000\000\000\131\002\000\000\000\000\000\000\040\000"}, + {292, "if_stmt", 0, 8, states_36, + "\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000"}, + {293, "while_stmt", 0, 8, states_37, + "\000\000\000\000\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\000"}, + {294, "for_stmt", 0, 10, states_38, + "\000\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000"}, + {295, "try_stmt", 0, 13, states_39, + "\000\000\000\000\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\000"}, + {296, "with_stmt", 0, 6, states_40, + "\000\000\000\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000"}, + {297, "with_var", 0, 3, states_41, + "\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000"}, + {298, "except_clause", 0, 5, states_42, + "\000\000\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000"}, + {299, "suite", 0, 5, states_43, + "\004\040\010\000\000\000\000\012\236\206\003\000\000\010\002\000\140\010\311\000\040"}, + {300, "testlist_safe", 0, 5, states_44, + "\000\040\010\000\000\000\000\000\000\004\000\000\000\010\002\000\140\010\311\000\000"}, + {301, "old_test", 0, 2, states_45, + "\000\040\010\000\000\000\000\000\000\004\000\000\000\010\002\000\140\010\311\000\000"}, + {302, "old_lambdef", 0, 5, states_46, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000"}, + {303, "test", 0, 6, states_47, + "\000\040\010\000\000\000\000\000\000\004\000\000\000\010\002\000\140\010\311\000\000"}, + {304, "or_test", 0, 2, states_48, + "\000\040\010\000\000\000\000\000\000\004\000\000\000\000\002\000\140\010\311\000\000"}, + {305, "and_test", 0, 2, states_49, + "\000\040\010\000\000\000\000\000\000\004\000\000\000\000\002\000\140\010\311\000\000"}, + {306, "not_test", 0, 3, states_50, + "\000\040\010\000\000\000\000\000\000\004\000\000\000\000\002\000\140\010\311\000\000"}, + {307, "comparison", 0, 2, states_51, + "\000\040\010\000\000\000\000\000\000\004\000\000\000\000\000\000\140\010\311\000\000"}, + {308, "comp_op", 0, 4, states_52, + "\000\000\000\000\000\000\000\000\000\000\000\040\000\000\362\007\000\000\000\000\000"}, + {309, "expr", 0, 2, states_53, + "\000\040\010\000\000\000\000\000\000\004\000\000\000\000\000\000\140\010\311\000\000"}, + {310, "xor_expr", 0, 2, states_54, + "\000\040\010\000\000\000\000\000\000\004\000\000\000\000\000\000\140\010\311\000\000"}, + {311, "and_expr", 0, 2, states_55, + "\000\040\010\000\000\000\000\000\000\004\000\000\000\000\000\000\140\010\311\000\000"}, + {312, "shift_expr", 0, 2, states_56, + "\000\040\010\000\000\000\000\000\000\004\000\000\000\000\000\000\140\010\311\000\000"}, + {313, "arith_expr", 0, 2, states_57, + "\000\040\010\000\000\000\000\000\000\004\000\000\000\000\000\000\140\010\311\000\000"}, + {314, "term", 0, 2, states_58, + "\000\040\010\000\000\000\000\000\000\004\000\000\000\000\000\000\140\010\311\000\000"}, + {315, "factor", 0, 3, states_59, + "\000\040\010\000\000\000\000\000\000\004\000\000\000\000\000\000\140\010\311\000\000"}, + {316, "power", 0, 4, states_60, + "\000\040\010\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000\311\000\000"}, + {317, "atom", 0, 11, states_61, + "\000\040\010\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000\311\000\000"}, + {318, "listmaker", 0, 5, states_62, + "\000\040\010\000\000\000\000\000\000\004\000\000\000\010\002\000\140\010\311\000\000"}, + {319, "testlist_gexp", 0, 5, states_63, + "\000\040\010\000\000\000\000\000\000\004\000\000\000\010\002\000\140\010\311\000\000"}, + {320, "lambdef", 0, 5, states_64, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000"}, + {321, "trailer", 0, 7, states_65, + "\000\040\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000\001\000\000"}, + {322, "subscriptlist", 0, 3, states_66, + "\000\040\210\000\000\000\000\000\000\004\000\000\000\010\002\000\140\010\311\000\000"}, + {323, "subscript", 0, 5, states_67, + "\000\040\210\000\000\000\000\000\000\004\000\000\000\010\002\000\140\010\311\000\000"}, + {324, "sliceop", 0, 3, states_68, + "\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {325, "exprlist", 0, 3, states_69, + "\000\040\010\000\000\000\000\000\000\004\000\000\000\000\000\000\140\010\311\000\000"}, + {326, "testlist", 0, 3, states_70, + "\000\040\010\000\000\000\000\000\000\004\000\000\000\010\002\000\140\010\311\000\000"}, + {327, "dictsetmaker", 0, 8, states_71, + "\000\040\010\000\000\000\000\000\000\004\000\000\000\010\002\000\140\010\311\000\000"}, + {328, "classdef", 0, 8, states_72, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\040\000"}, + {329, "arglist", 0, 8, states_73, + "\000\040\010\140\000\000\000\000\000\004\000\000\000\010\002\000\140\010\311\000\000"}, + {330, "argument", 0, 4, states_74, + "\000\040\010\000\000\000\000\000\000\004\000\000\000\010\002\000\140\010\311\000\000"}, + {331, "list_iter", 0, 2, states_75, + "\000\000\000\000\000\000\000\000\000\000\000\021\000\000\000\000\000\000\000\000\000"}, + {332, "list_for", 0, 6, states_76, + "\000\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000"}, + {333, "list_if", 0, 4, states_77, + "\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000"}, + {334, "gen_iter", 0, 2, states_78, + "\000\000\000\000\000\000\000\000\000\000\000\021\000\000\000\000\000\000\000\000\000"}, + {335, "gen_for", 0, 6, states_79, + "\000\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000"}, + {336, "gen_if", 0, 4, states_80, + "\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000"}, + {337, "testlist1", 0, 2, states_81, + "\000\040\010\000\000\000\000\000\000\004\000\000\000\010\002\000\140\010\311\000\000"}, + {338, "encoding_decl", 0, 2, states_82, + "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + {339, "yield_expr", 0, 3, states_83, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\040"}, }; -static label labels[170] = { +static label labels[166] = { {0, "EMPTY"}, {256, 0}, {4, 0}, - {272, 0}, - {295, 0}, + {268, 0}, + {291, 0}, {257, 0}, - {271, 0}, + {267, 0}, {0, 0}, {258, 0}, - {330, 0}, + {326, 0}, {259, 0}, {50, 0}, - {291, 0}, + {287, 0}, {7, 0}, - {333, 0}, + {329, 0}, {8, 0}, {260, 0}, {261, 0}, @@ -2072,33 +1994,29 @@ {1, 0}, {262, 0}, {51, 0}, - {307, 0}, - {11, 0}, {303, 0}, + {11, 0}, + {299, 0}, {263, 0}, - {265, 0}, + {264, 0}, {22, 0}, {12, 0}, {16, 0}, - {264, 0}, {36, 0}, + {265, 0}, {266, 0}, - {267, 0}, {269, 0}, - {268, 0}, + {13, 0}, {270, 0}, + {272, 0}, {273, 0}, - {13, 0}, {274, 0}, - {276, 0}, - {277, 0}, - {278, 0}, - {284, 0}, - {292, 0}, - {293, 0}, - {294, 0}, - {275, 0}, - {343, 0}, + {280, 0}, + {288, 0}, + {289, 0}, + {290, 0}, + {271, 0}, + {339, 0}, {37, 0}, {38, 0}, {39, 0}, @@ -2112,36 +2030,36 @@ {47, 0}, {49, 0}, {1, "del"}, - {329, 0}, + {325, 0}, {1, "pass"}, + {275, 0}, + {276, 0}, + {277, 0}, {279, 0}, - {280, 0}, - {281, 0}, - {283, 0}, - {282, 0}, + {278, 0}, {1, "break"}, {1, "continue"}, {1, "return"}, {1, "raise"}, - {285, 0}, - {286, 0}, + {281, 0}, + {282, 0}, {1, "import"}, - {290, 0}, + {286, 0}, {1, "from"}, {23, 0}, - {289, 0}, - {287, 0}, + {285, 0}, + {283, 0}, {1, "as"}, - {288, 0}, + {284, 0}, {1, "global"}, {1, "nonlocal"}, {1, "assert"}, + {292, 0}, + {293, 0}, + {294, 0}, + {295, 0}, {296, 0}, - {297, 0}, - {298, 0}, - {299, 0}, - {300, 0}, - {332, 0}, + {328, 0}, {1, "if"}, {1, "elif"}, {1, "else"}, @@ -2149,27 +2067,27 @@ {1, "for"}, {1, "in"}, {1, "try"}, - {302, 0}, + {298, 0}, {1, "finally"}, {1, "with"}, - {301, 0}, - {313, 0}, + {297, 0}, + {309, 0}, {1, "except"}, {5, 0}, {6, 0}, + {300, 0}, + {301, 0}, {304, 0}, - {305, 0}, - {308, 0}, - {306, 0}, + {302, 0}, {1, "lambda"}, - {324, 0}, - {309, 0}, + {320, 0}, + {305, 0}, {1, "or"}, - {310, 0}, + {306, 0}, {1, "and"}, {1, "not"}, - {311, 0}, - {312, 0}, + {307, 0}, + {308, 0}, {20, 0}, {21, 0}, {28, 0}, @@ -2177,53 +2095,53 @@ {30, 0}, {29, 0}, {1, "is"}, - {314, 0}, + {310, 0}, {18, 0}, - {315, 0}, + {311, 0}, {33, 0}, - {316, 0}, + {312, 0}, {19, 0}, - {317, 0}, + {313, 0}, {34, 0}, {35, 0}, - {318, 0}, + {314, 0}, {14, 0}, {15, 0}, - {319, 0}, + {315, 0}, {17, 0}, {24, 0}, {48, 0}, {32, 0}, - {320, 0}, + {316, 0}, + {317, 0}, {321, 0}, - {325, 0}, - {323, 0}, + {319, 0}, {9, 0}, - {322, 0}, + {318, 0}, {10, 0}, {26, 0}, - {331, 0}, + {327, 0}, {27, 0}, {2, 0}, {3, 0}, - {336, 0}, - {339, 0}, - {326, 0}, - {327, 0}, - {328, 0}, + {332, 0}, + {335, 0}, + {322, 0}, + {323, 0}, + {324, 0}, {1, "class"}, + {330, 0}, + {331, 0}, + {333, 0}, {334, 0}, - {335, 0}, + {336, 0}, {337, 0}, {338, 0}, - {340, 0}, - {341, 0}, - {342, 0}, {1, "yield"}, }; grammar _PyParser_Grammar = { - 88, + 84, dfas, - {170, labels}, + {166, labels}, 256 }; Index: Python/ast.c =================================================================== --- Python/ast.c (revision 54264) +++ Python/ast.c (working copy) @@ -555,13 +555,13 @@ } static arg_ty -compiler_simple_arg(struct compiling *c, const node *n) +compiler_arg(struct compiling *c, const node *n) { identifier name; expr_ty annotation = NULL; node *ch; - assert(TYPE(n) == tname || TYPE(n) == vname); + assert(TYPE(n) == tfpdef || TYPE(n) == vfpdef); ch = CHILD(n, 0); if (!strcmp(STR(ch), "None")) { ast_error(ch, "assignment to None"); @@ -577,51 +577,12 @@ return NULL; } - return SimpleArg(name, annotation, c->c_arena); + return arg(name, annotation, c->c_arena); } -static arg_ty -compiler_complex_args(struct compiling *c, const node *n) -{ - int i, len = (NCH(n) + 1) / 2; - arg_ty arg; - asdl_seq *args = asdl_seq_new(len, c->c_arena); - if (!args) - return NULL; - - assert(TYPE(n) == tfplist || TYPE(n) == vfplist); - for (i = 0; i < len; i++) { - const node *child = CHILD(n, 2*i); - /* def foo(((x), y)): -- x is not nested complex, special case. */ - while (NCH(child) == 3 && NCH(CHILD(child, 1)) == 1) - child = CHILD(CHILD(child, 1), 0); - - /* child either holds a tname or '(', a tfplist, ')' */ - switch (TYPE(CHILD(child, 0))) { - case tname: - case vname: - arg = compiler_simple_arg(c, CHILD(child, 0)); - break; - case LPAR: - arg = compiler_complex_args(c, CHILD(child, 1)); - break; - default: - PyErr_Format(PyExc_SystemError, - "unexpected node in args: %d @ %d", - TYPE(CHILD(child, 0)), i); - arg = NULL; - } - if (!arg) - return NULL; - asdl_seq_SET(args, i, arg); - } - - return NestedArgs(args, c->c_arena); -} - /* returns -1 if failed to handle keyword only arguments returns new position to keep processing if successful - (',' tname ['=' test])* + (',' tfpdef ['=' test])* ^^^ start pointing here */ @@ -639,8 +600,8 @@ while (i < NCH(n)) { ch = CHILD(n, i); switch (TYPE(ch)) { - case vname: - case tname: + case vfpdef: + case tfpdef: if (i + 1 < NCH(n) && TYPE(CHILD(n, i + 1)) == EQUAL) { expression = ast_for_expr(c, CHILD(n, i + 2)); if (!expression) { @@ -669,7 +630,7 @@ ast_error(ch, "assignment to None"); goto error; } - arg = SimpleArg(NEW_IDENTIFIER(ch), annotation, c->c_arena); + arg = arg(NEW_IDENTIFIER(ch), annotation, c->c_arena); if (!arg) { ast_error(ch, "expecting name"); goto error; @@ -699,13 +660,15 @@ parameters: '(' [typedargslist] ')' typedargslist: ((tfpdef ['=' test] ',')* - ('*' [tname] (',' tname ['=' test])* [',' '**' tname] - | '**' tname) + ('*' [tfpdef] (',' tfpdef ['=' test])* [',' '**' tfpdef] + | '**' tfpdef) | tfpdef ['=' test] (',' tfpdef ['=' test])* [',']) + tfpdef: NAME [':' test] varargslist: ((vfpdef ['=' test] ',')* - ('*' [vname] (',' vname ['=' test])* [',' '**' vname] - | '**' vname) + ('*' [vfpdef] (',' vfpdef ['=' test])* [',' '**' vfpdef] + | '**' vfpdef) | vfpdef ['=' test] (',' vfpdef ['=' test])* [',']) + vfpdef: NAME */ int i, j, k, nposargs = 0, nkwonlyargs = 0; int nposdefaults = 0, found_default = 0; @@ -727,17 +690,13 @@ for (i = 0; i < NCH(n); i++) { ch = CHILD(n, i); if (TYPE(ch) == STAR) { - if (TYPE(CHILD(n, i+1)) == tname - || TYPE(CHILD(n, i+1)) == vname) { - /* skip NAME of vararg */ - /* so that following can count only keyword only args */ - i += 2; - } - else { - i++; - } + /* skip star and possible argument */ + i++; + i += (TYPE(CHILD(n, i)) == tfpdef + || TYPE(CHILD(n, i)) == vfpdef); break; } + if (TYPE(ch) == DOUBLESTAR) break; if (TYPE(ch) == vfpdef || TYPE(ch) == tfpdef) nposargs++; if (TYPE(ch) == EQUAL) nposdefaults++; } @@ -746,9 +705,8 @@ for ( ; i < NCH(n); ++i) { ch = CHILD(n, i); if (TYPE(ch) == DOUBLESTAR) break; - if (TYPE(ch) == tname || TYPE(ch) == vname) nkwonlyargs++; + if (TYPE(ch) == tfpdef || TYPE(ch) == vfpdef) nkwonlyargs++; } - posargs = (nposargs ? asdl_seq_new(nposargs, c->c_arena) : NULL); if (!posargs && nposargs) goto error; @@ -773,12 +731,8 @@ return NULL; } - /* tname: NAME [':' test] - tfpdef: tname | '(' tfplist ')' - tfplist: tfpdef (',' tfpdef)* [','] - vname: NAME - vfpdef: NAME | '(' vfplist ')' - vfplist: vfpdef (',' vfpdef)* [','] + /* tfpdef: NAME [':' test] + vfpdef: NAME */ i = 0; j = 0; /* index for defaults */ @@ -805,14 +759,7 @@ "non-default argument follows default argument"); goto error; } - /* def foo((x)): is not complex, special case. */ - while (NCH(ch) == 3 && NCH(CHILD(ch, 1)) == 1) - ch = CHILD(CHILD(ch, 1), 0); - - if (NCH(ch) != 1) - arg = compiler_complex_args(c, CHILD(ch, 1)); - else - arg = compiler_simple_arg(c, CHILD(ch, 0)); + arg = compiler_arg(c, ch); if (!arg) goto error; asdl_seq_SET(posargs, k++, arg); @@ -824,7 +771,7 @@ ast_error(CHILD(n, i), "no name for vararg"); goto error; } - ch = CHILD(n, i+1); /* tname or COMMA */ + ch = CHILD(n, i+1); /* tfpdef or COMMA */ if (TYPE(ch) == COMMA) { int res = 0; i += 2; /* now follows keyword only arguments */ @@ -840,12 +787,12 @@ else { vararg = NEW_IDENTIFIER(CHILD(ch, 0)); if (NCH(ch) > 1) { - /* there is an annotation on the vararg */ - varargannotation = ast_for_expr(c, CHILD(ch, 2)); + /* there is an annotation on the vararg */ + varargannotation = ast_for_expr(c, CHILD(ch, 2)); } i += 3; - if (i < NCH(n) && (TYPE(CHILD(n, i)) == tname - || TYPE(CHILD(n, i)) == vname)) { + if (i < NCH(n) && (TYPE(CHILD(n, i)) == tfpdef + || TYPE(CHILD(n, i)) == vfpdef)) { int res = 0; res = handle_keywordonly_args(c, n, i, kwonlyargs, kwdefaults); @@ -855,8 +802,8 @@ } break; case DOUBLESTAR: - ch = CHILD(n, i+1); /* tname */ - assert(TYPE(ch) == tname || TYPE(ch) == vname); + ch = CHILD(n, i+1); /* tfpdef */ + assert(TYPE(ch) == tfpdef || TYPE(ch) == vfpdef); if (!strcmp(STR(CHILD(ch, 0)), "None")) { ast_error(CHILD(ch, 0), "assignment to None"); goto error; Index: Python/symtable.c =================================================================== --- Python/symtable.c (revision 54264) +++ Python/symtable.c (working copy) @@ -178,10 +178,8 @@ static int symtable_visit_comprehension(struct symtable *st, comprehension_ty); static int symtable_visit_keyword(struct symtable *st, keyword_ty); static int symtable_visit_slice(struct symtable *st, slice_ty); -static int symtable_visit_params(struct symtable *st, asdl_seq *args, int top, - int annotations); -static int symtable_visit_params_nested(struct symtable *st, asdl_seq *args, - int annotations); +static int symtable_visit_params(struct symtable *st, asdl_seq *args); +static int symtable_visit_argannotations(struct symtable *st, asdl_seq *args); static int symtable_implicit_arg(struct symtable *st, int pos); static int symtable_visit_annotations(struct symtable *st, stmt_ty s); @@ -1275,79 +1273,51 @@ } static int -symtable_visit_params(struct symtable *st, asdl_seq *args, int toplevel, - int annotations) +symtable_visit_params(struct symtable *st, asdl_seq *args) { int i; if (!args) return -1; - /* go through all the toplevel arguments first */ for (i = 0; i < asdl_seq_LEN(args); i++) { arg_ty arg = (arg_ty)asdl_seq_GET(args, i); - if (arg->kind == SimpleArg_kind) { - if (!annotations) { - if (!symtable_add_def(st, - arg->v.SimpleArg.arg, - DEF_PARAM)) - return 0; - } - else if (arg->v.SimpleArg.annotation) - VISIT(st, expr, arg->v.SimpleArg.annotation); - } - else if (arg->kind == NestedArgs_kind) { - if (toplevel && !annotations) { - if (!symtable_implicit_arg(st, i)) - return 0; - } - } - else { - PyErr_SetString(PyExc_SyntaxError, - "invalid expression in parameter list"); - PyErr_SyntaxLocation(st->st_filename, - st->st_cur->ste_lineno); + if (!symtable_add_def(st, arg->arg, DEF_PARAM)) return 0; - } } - if (!toplevel) { - if (!symtable_visit_params_nested(st, args, annotations)) - return 0; - } - return 1; } -static int -symtable_visit_params_nested(struct symtable *st, asdl_seq *args, - int annotations) +static int +symtable_visit_argannotations(struct symtable *st, asdl_seq *args) { int i; + + if (!args) + return -1; + for (i = 0; i < asdl_seq_LEN(args); i++) { arg_ty arg = (arg_ty)asdl_seq_GET(args, i); - if (arg->kind == NestedArgs_kind && - !symtable_visit_params(st, arg->v.NestedArgs.args, 0, - annotations)) - return 0; + if (arg->annotation) + VISIT(st, expr, arg->annotation); } return 1; } - static int symtable_visit_annotations(struct symtable *st, stmt_ty s) { arguments_ty a = s->v.FunctionDef.args; - if (a->args && !symtable_visit_params(st, a->args, 1, 1)) + if (a->args && !symtable_visit_argannotations(st, a->args)) return 0; if (a->varargannotation) VISIT(st, expr, a->varargannotation); if (a->kwargannotation) VISIT(st, expr, a->kwargannotation); - if (a->kwonlyargs && !symtable_visit_params(st, a->kwonlyargs, 1, 1)) + if (a->kwonlyargs && !symtable_visit_argannotations(st, a->kwonlyargs)) return 0; if (s->v.FunctionDef.returns) VISIT(st, expr, s->v.FunctionDef.returns); @@ -1360,9 +1330,9 @@ /* skip default arguments inside function block XXX should ast be different? */ - if (a->args && !symtable_visit_params(st, a->args, 1, 0)) + if (a->args && !symtable_visit_params(st, a->args)) return 0; - if (a->kwonlyargs && !symtable_visit_params(st, a->kwonlyargs, 1, 0)) + if (a->kwonlyargs && !symtable_visit_params(st, a->kwonlyargs)) return 0; if (a->vararg) { if (!symtable_add_def(st, a->vararg, DEF_PARAM)) @@ -1374,8 +1344,6 @@ return 0; st->st_cur->ste_varkeywords = 1; } - if (a->args && !symtable_visit_params_nested(st, a->args, 0)) - return 0; return 1; } Index: Python/compile.c =================================================================== --- Python/compile.c (revision 54264) +++ Python/compile.c (working copy) @@ -1261,54 +1261,6 @@ } static int -compiler_unpack_nested(struct compiler *c, asdl_seq *args) { - int i, len; - len = asdl_seq_LEN(args); - ADDOP_I(c, UNPACK_SEQUENCE, len); - for (i = 0; i < len; i++) { - arg_ty elt = (arg_ty)asdl_seq_GET(args, i); - switch (elt->kind) { - case SimpleArg_kind: - if (!compiler_nameop(c, elt->v.SimpleArg.arg, Store)) - return 0; - break; - case NestedArgs_kind: - if (!compiler_unpack_nested(c, elt->v.NestedArgs.args)) - return 0; - break; - default: - return 0; - } - } - return 1; -} - -static int -compiler_arguments(struct compiler *c, arguments_ty args) -{ - int i; - int n = asdl_seq_LEN(args->args); - - for (i = 0; i < n; i++) { - arg_ty arg = (arg_ty)asdl_seq_GET(args->args, i); - if (arg->kind == NestedArgs_kind) { - PyObject *id = PyString_FromFormat(".%d", i); - if (id == NULL) { - return 0; - } - if (!compiler_nameop(c, id, Load)) { - Py_DECREF(id); - return 0; - } - Py_DECREF(id); - if (!compiler_unpack_nested(c, arg->v.NestedArgs.args)) - return 0; - } - } - return 1; -} - -static int compiler_visit_kwonlydefaults(struct compiler *c, asdl_seq *kwonlyargs, asdl_seq *kw_defaults) { @@ -1317,7 +1269,7 @@ arg_ty arg = asdl_seq_GET(kwonlyargs, i); expr_ty default_ = asdl_seq_GET(kw_defaults, i); if (default_) { - ADDOP_O(c, LOAD_CONST, arg->v.SimpleArg.arg, consts); + ADDOP_O(c, LOAD_CONST, arg->arg, consts); if (!compiler_visit_expr(c, default_)) { return -1; } @@ -1346,17 +1298,11 @@ int i, error; for (i = 0; i < asdl_seq_LEN(args); i++) { arg_ty arg = (arg_ty)asdl_seq_GET(args, i); - if (arg->kind == NestedArgs_kind) - error = compiler_visit_argannotations( - c, - arg->v.NestedArgs.args, - names); - else - error = compiler_visit_argannotation( - c, - arg->v.SimpleArg.arg, - arg->v.SimpleArg.annotation, - names); + error = compiler_visit_argannotation( + c, + arg->arg, + arg->annotation, + names); if (error) return error; } @@ -1476,9 +1422,6 @@ return 0; } - /* unpack nested arguments */ - compiler_arguments(c, args); - c->u->u_argcount = asdl_seq_LEN(args->args); c->u->u_kwonlyargcount = asdl_seq_LEN(args->kwonlyargs); n = asdl_seq_LEN(s->v.FunctionDef.body); @@ -1612,9 +1555,6 @@ if (!compiler_enter_scope(c, name, (void *)e, e->lineno)) return 0; - /* unpack nested arguments */ - compiler_arguments(c, args); - c->u->u_argcount = asdl_seq_LEN(args->args); c->u->u_kwonlyargcount = asdl_seq_LEN(args->kwonlyargs); VISIT_IN_SCOPE(c, expr, e->v.Lambda.body); Index: Python/Python-ast.c =================================================================== --- Python/Python-ast.c (revision 54264) +++ Python/Python-ast.c (working copy) @@ -354,15 +354,10 @@ }; static PyTypeObject *arg_type; static PyObject* ast2obj_arg(void*); -static PyTypeObject *SimpleArg_type; -static char *SimpleArg_fields[]={ +static char *arg_fields[]={ "arg", "annotation", }; -static PyTypeObject *NestedArgs_type; -static char *NestedArgs_fields[]={ - "args", -}; static PyTypeObject *keyword_type; static PyObject* ast2obj_keyword(void*); static char *keyword_fields[]={ @@ -735,14 +730,8 @@ if (!excepthandler_type) return 0; arguments_type = make_type("arguments", AST_type, arguments_fields, 8); if (!arguments_type) return 0; - arg_type = make_type("arg", AST_type, NULL, 0); + arg_type = make_type("arg", AST_type, arg_fields, 2); if (!arg_type) return 0; - if (!add_attributes(arg_type, NULL, 0)) return 0; - SimpleArg_type = make_type("SimpleArg", arg_type, SimpleArg_fields, 2); - if (!SimpleArg_type) return 0; - NestedArgs_type = make_type("NestedArgs", arg_type, NestedArgs_fields, - 1); - if (!NestedArgs_type) return 0; keyword_type = make_type("keyword", AST_type, keyword_fields, 2); if (!keyword_type) return 0; alias_type = make_type("alias", AST_type, alias_fields, 2); @@ -1797,35 +1786,22 @@ } arg_ty -SimpleArg(identifier arg, expr_ty annotation, PyArena *arena) +arg(identifier arg, expr_ty annotation, PyArena *arena) { arg_ty p; if (!arg) { PyErr_SetString(PyExc_ValueError, - "field arg is required for SimpleArg"); + "field arg is required for arg"); return NULL; } p = (arg_ty)PyArena_Malloc(arena, sizeof(*p)); if (!p) return NULL; - p->kind = SimpleArg_kind; - p->v.SimpleArg.arg = arg; - p->v.SimpleArg.annotation = annotation; + p->arg = arg; + p->annotation = annotation; return p; } -arg_ty -NestedArgs(asdl_seq * args, PyArena *arena) -{ - arg_ty p; - p = (arg_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = NestedArgs_kind; - p->v.NestedArgs.args = args; - return p; -} - keyword_ty keyword(identifier arg, expr_ty value, PyArena *arena) { @@ -2936,31 +2912,18 @@ return Py_None; } - switch (o->kind) { - case SimpleArg_kind: - result = PyType_GenericNew(SimpleArg_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_identifier(o->v.SimpleArg.arg); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "arg", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_expr(o->v.SimpleArg.annotation); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "annotation", value) == -1) - goto failed; - Py_DECREF(value); - break; - case NestedArgs_kind: - result = PyType_GenericNew(NestedArgs_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_list(o->v.NestedArgs.args, ast2obj_arg); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "args", value) == -1) - goto failed; - Py_DECREF(value); - break; - } + result = PyType_GenericNew(arg_type, NULL, NULL); + if (!result) return NULL; + value = ast2obj_identifier(o->arg); + if (!value) goto failed; + if (PyObject_SetAttrString(result, "arg", value) == -1) + goto failed; + Py_DECREF(value); + value = ast2obj_expr(o->annotation); + if (!value) goto failed; + if (PyObject_SetAttrString(result, "annotation", value) == -1) + goto failed; + Py_DECREF(value); return result; failed: Py_XDECREF(value); @@ -3179,10 +3142,6 @@ if (PyDict_SetItemString(d, "arguments", (PyObject*)arguments_type) < 0) return; if (PyDict_SetItemString(d, "arg", (PyObject*)arg_type) < 0) return; - if (PyDict_SetItemString(d, "SimpleArg", (PyObject*)SimpleArg_type) < - 0) return; - if (PyDict_SetItemString(d, "NestedArgs", (PyObject*)NestedArgs_type) < - 0) return; if (PyDict_SetItemString(d, "keyword", (PyObject*)keyword_type) < 0) return; if (PyDict_SetItemString(d, "alias", (PyObject*)alias_type) < 0) return; Index: Include/graminit.h =================================================================== --- Include/graminit.h (revision 54264) +++ Include/graminit.h (working copy) @@ -6,83 +6,79 @@ #define funcdef 261 #define parameters 262 #define typedargslist 263 -#define tname 264 -#define tfpdef 265 -#define tfplist 266 -#define varargslist 267 -#define vname 268 -#define vfpdef 269 -#define vfplist 270 -#define stmt 271 -#define simple_stmt 272 -#define small_stmt 273 -#define expr_stmt 274 -#define augassign 275 -#define del_stmt 276 -#define pass_stmt 277 -#define flow_stmt 278 -#define break_stmt 279 -#define continue_stmt 280 -#define return_stmt 281 -#define yield_stmt 282 -#define raise_stmt 283 -#define import_stmt 284 -#define import_name 285 -#define import_from 286 -#define import_as_name 287 -#define dotted_as_name 288 -#define import_as_names 289 -#define dotted_as_names 290 -#define dotted_name 291 -#define global_stmt 292 -#define nonlocal_stmt 293 -#define assert_stmt 294 -#define compound_stmt 295 -#define if_stmt 296 -#define while_stmt 297 -#define for_stmt 298 -#define try_stmt 299 -#define with_stmt 300 -#define with_var 301 -#define except_clause 302 -#define suite 303 -#define testlist_safe 304 -#define old_test 305 -#define old_lambdef 306 -#define test 307 -#define or_test 308 -#define and_test 309 -#define not_test 310 -#define comparison 311 -#define comp_op 312 -#define expr 313 -#define xor_expr 314 -#define and_expr 315 -#define shift_expr 316 -#define arith_expr 317 -#define term 318 -#define factor 319 -#define power 320 -#define atom 321 -#define listmaker 322 -#define testlist_gexp 323 -#define lambdef 324 -#define trailer 325 -#define subscriptlist 326 -#define subscript 327 -#define sliceop 328 -#define exprlist 329 -#define testlist 330 -#define dictsetmaker 331 -#define classdef 332 -#define arglist 333 -#define argument 334 -#define list_iter 335 -#define list_for 336 -#define list_if 337 -#define gen_iter 338 -#define gen_for 339 -#define gen_if 340 -#define testlist1 341 -#define encoding_decl 342 -#define yield_expr 343 +#define tfpdef 264 +#define varargslist 265 +#define vfpdef 266 +#define stmt 267 +#define simple_stmt 268 +#define small_stmt 269 +#define expr_stmt 270 +#define augassign 271 +#define del_stmt 272 +#define pass_stmt 273 +#define flow_stmt 274 +#define break_stmt 275 +#define continue_stmt 276 +#define return_stmt 277 +#define yield_stmt 278 +#define raise_stmt 279 +#define import_stmt 280 +#define import_name 281 +#define import_from 282 +#define import_as_name 283 +#define dotted_as_name 284 +#define import_as_names 285 +#define dotted_as_names 286 +#define dotted_name 287 +#define global_stmt 288 +#define nonlocal_stmt 289 +#define assert_stmt 290 +#define compound_stmt 291 +#define if_stmt 292 +#define while_stmt 293 +#define for_stmt 294 +#define try_stmt 295 +#define with_stmt 296 +#define with_var 297 +#define except_clause 298 +#define suite 299 +#define testlist_safe 300 +#define old_test 301 +#define old_lambdef 302 +#define test 303 +#define or_test 304 +#define and_test 305 +#define not_test 306 +#define comparison 307 +#define comp_op 308 +#define expr 309 +#define xor_expr 310 +#define and_expr 311 +#define shift_expr 312 +#define arith_expr 313 +#define term 314 +#define factor 315 +#define power 316 +#define atom 317 +#define listmaker 318 +#define testlist_gexp 319 +#define lambdef 320 +#define trailer 321 +#define subscriptlist 322 +#define subscript 323 +#define sliceop 324 +#define exprlist 325 +#define testlist 326 +#define dictsetmaker 327 +#define classdef 328 +#define arglist 329 +#define argument 330 +#define list_iter 331 +#define list_for 332 +#define list_if 333 +#define gen_iter 334 +#define gen_for 335 +#define gen_if 336 +#define testlist1 337 +#define encoding_decl 338 +#define yield_expr 339 Index: Include/Python-ast.h =================================================================== --- Include/Python-ast.h (revision 54264) +++ Include/Python-ast.h (working copy) @@ -341,20 +341,9 @@ asdl_seq *kw_defaults; }; -enum _arg_kind {SimpleArg_kind=1, NestedArgs_kind=2}; struct _arg { - enum _arg_kind kind; - union { - struct { - identifier arg; - expr_ty annotation; - } SimpleArg; - - struct { - asdl_seq *args; - } NestedArgs; - - } v; + identifier arg; + expr_ty annotation; }; struct _keyword { @@ -514,10 +503,8 @@ varargannotation, asdl_seq * kwonlyargs, identifier kwarg, expr_ty kwargannotation, asdl_seq * defaults, asdl_seq * kw_defaults, PyArena *arena); -#define SimpleArg(a0, a1, a2) _Py_SimpleArg(a0, a1, a2) -arg_ty _Py_SimpleArg(identifier arg, expr_ty annotation, PyArena *arena); -#define NestedArgs(a0, a1) _Py_NestedArgs(a0, a1) -arg_ty _Py_NestedArgs(asdl_seq * args, PyArena *arena); +#define arg(a0, a1, a2) _Py_arg(a0, a1, a2) +arg_ty _Py_arg(identifier arg, expr_ty annotation, PyArena *arena); #define keyword(a0, a1, a2) _Py_keyword(a0, a1, a2) keyword_ty _Py_keyword(identifier arg, expr_ty value, PyArena *arena); #define alias(a0, a1, a2) _Py_alias(a0, a1, a2) Index: Grammar/Grammar =================================================================== --- Grammar/Grammar (revision 54264) +++ Grammar/Grammar (working copy) @@ -24,17 +24,13 @@ funcdef: [decorators] 'def' NAME parameters ['->' test] ':' suite parameters: '(' [typedargslist] ')' typedargslist: ((tfpdef ['=' test] ',')* - ('*' [tname] (',' tname ['=' test])* [',' '**' tname] | '**' tname) + ('*' [tfpdef] (',' tfpdef ['=' test])* [',' '**' tfpdef] | '**' tfpdef) | tfpdef ['=' test] (',' tfpdef ['=' test])* [',']) -tname: NAME [':' test] -tfpdef: tname | '(' tfplist ')' -tfplist: tfpdef (',' tfpdef)* [','] +tfpdef: NAME [':' test] varargslist: ((vfpdef ['=' test] ',')* - ('*' [vname] (',' vname ['=' test])* [',' '**' vname] | '**' vname) + ('*' [vfpdef] (',' vfpdef ['=' test])* [',' '**' vfpdef] | '**' vfpdef) | vfpdef ['=' test] (',' vfpdef ['=' test])* [',']) -vname: NAME -vfpdef: vname | '(' vfplist ')' -vfplist: vfpdef (',' vfpdef)* [','] +vfpdef: NAME stmt: simple_stmt | compound_stmt simple_stmt: small_stmt (';' small_stmt)* [';'] NEWLINE Index: Parser/Python.asdl =================================================================== --- Parser/Python.asdl (revision 54264) +++ Parser/Python.asdl (working copy) @@ -103,8 +103,7 @@ arg* kwonlyargs, identifier? kwarg, expr? kwargannotation, expr* defaults, expr* kw_defaults) - arg = SimpleArg(identifier arg, expr? annotation) - | NestedArgs(arg* args) + arg = (identifier arg, expr? annotation) -- keyword arguments supplied to call keyword = (identifier arg, expr value) Index: Tools/compiler/ast.txt =================================================================== --- Tools/compiler/ast.txt (revision 54264) +++ Tools/compiler/ast.txt (working copy) @@ -14,8 +14,7 @@ Decorators: nodes! Function: decorators&, name*, arguments!, defaults!, kwonlyargs!, returns&, flags*, doc*, code Lambda: arguments!, defaults!, kwonlyargs!, flags*, code -SimpleArg: name*, annotation& -NestedArgs: args! +Arg: name*, annotation& Kwarg: arg, expr Class: name*, bases!, doc*, code Pass: @@ -68,18 +67,19 @@ Bitor: nodes! Bitxor: nodes! Bitand: nodes! -LeftShift: (left, right) -RightShift: (left, right) -Add: (left, right) -Sub: (left, right) -Mul: (left, right) -Div: (left, right) -Mod: (left, right) -Power: (left, right) -FloorDiv: (left, right) +LeftShift: left, right +RightShift: left, right +Add: left, right +Sub: left, right +Mul: left, right +Div: left, right +Mod: left, right +Power: left, right +FloorDiv: left, right UnaryAdd: expr UnarySub: expr Invert: expr +Bytes: value* init(Function): self.varargs = self.kwargs = None @@ -97,7 +97,7 @@ self.returns = None init(GenExpr): - self.arguments = [SimpleArg('.0', None)] + self.arguments = [Arg('.0', None)] self.varargs = self.kwargs = None self.kwonlyargs = () Index: Tools/compiler/astgen.py =================================================================== --- Tools/compiler/astgen.py (revision 54264) +++ Tools/compiler/astgen.py (working copy) @@ -93,90 +93,90 @@ def gen_source(self): buf = StringIO() - print >> buf, "class %s(Node):" % self.name + print("class %s(Node):" % self.name, file=buf) self._gen_init(buf) - print >> buf + print(file=buf) self._gen_getChildren(buf) - print >> buf + print(file=buf) self._gen_getChildNodes(buf) - print >> buf + print(file=buf) self._gen_repr(buf) buf.seek(0, 0) return buf.read() def _gen_init(self, buf): if self.args: - print >> buf, " def __init__(self, %s, lineno=None):" % self.args + print(" def __init__(self, %s, lineno=None):" % self.args, file=buf) else: - print >> buf, " def __init__(self, lineno=None):" + print(" def __init__(self, lineno=None):", file=buf) if self.argnames: for name in self.argnames: - print >> buf, " self.%s = %s" % (name, name) - print >> buf, " self.lineno = lineno" + print(" self.%s = %s" % (name, name), file=buf) + print(" self.lineno = lineno", file=buf) # Copy the lines in self.init, indented four spaces. The rstrip() # business is to get rid of the four spaces if line happens to be # empty, so that reindent.py is happy with the output. for line in self.init: - print >> buf, (" " + line).rstrip() + print((" " + line).rstrip(), file=buf) def _gen_getChildren(self, buf): - print >> buf, " def getChildren(self):" + print(" def getChildren(self):", file=buf) if len(self.argnames) == 0: - print >> buf, " return ()" + print(" return ()", file=buf) else: if self.hardest_arg < P_NESTED: clist = COMMA.join(["self.%s" % c for c in self.argnames]) if self.nargs == 1: - print >> buf, " return %s," % clist + print(" return %s," % clist, file=buf) else: - print >> buf, " return %s" % clist + print(" return %s" % clist, file=buf) else: if len(self.argnames) == 1: - print >> buf, " return tuple(flatten(self.%s))" % self.argnames[0] + print(" return tuple(flatten(self.%s))" % self.argnames[0], file=buf) else: - print >> buf, " children = []" + print(" children = []", file=buf) template = " children.%s(%sself.%s%s)" for name in self.argnames: if self.argprops[name] == P_NESTED: - print >> buf, template % ("extend", "flatten(", - name, ")") + print(template % ("extend", "flatten(", + name, ")"), file=buf) else: - print >> buf, template % ("append", "", name, "") - print >> buf, " return tuple(children)" + print(template % ("append", "", name, ""), file=buf) + print(" return tuple(children)", file=buf) def _gen_getChildNodes(self, buf): - print >> buf, " def getChildNodes(self):" + print(" def getChildNodes(self):", file=buf) if len(self.argnames) == 0: - print >> buf, " return ()" + print(" return ()", file=buf) else: if self.hardest_arg < P_NESTED: clist = ["self.%s" % c for c in self.argnames if self.argprops[c] == P_NODE] if len(clist) == 0: - print >> buf, " return ()" + print(" return ()", file=buf) elif len(clist) == 1: - print >> buf, " return %s," % clist[0] + print(" return %s," % clist[0], file=buf) else: - print >> buf, " return %s" % COMMA.join(clist) + print(" return %s" % COMMA.join(clist), file=buf) else: - print >> buf, " nodelist = []" + print(" nodelist = []", file=buf) template = " nodelist.%s(%sself.%s%s)" for name in self.argnames: if self.argprops[name] == P_NONE: tmp = (" if self.%s is not None:\n" " nodelist.append(self.%s)") - print >> buf, tmp % (name, name) + print(tmp % (name, name), file=buf) elif self.argprops[name] == P_NESTED: - print >> buf, template % ("extend", "flatten_nodes(", - name, ")") + print(template % ("extend", "flatten_nodes(", + name, ")"), file=buf) elif self.argprops[name] == P_NODE: - print >> buf, template % ("append", "", name, "") - print >> buf, " return tuple(nodelist)" + print(template % ("append", "", name, ""), file=buf) + print(" return tuple(nodelist)", file=buf) def _gen_repr(self, buf): - print >> buf, " def __repr__(self):" + print(" def __repr__(self):", file=buf) if self.argnames: fmt = COMMA.join(["%s"] * self.nargs) if '(' in self.args: @@ -185,10 +185,10 @@ vals = COMMA.join(vals) if self.nargs == 1: vals = vals + "," - print >> buf, ' return "%s(%s)" %% (%s)' % \ - (self.name, fmt, vals) + print(' return "%s(%s)" %% (%s)' % \ + (self.name, fmt, vals), file=buf) else: - print >> buf, ' return "%s()"' % self.name + print(' return "%s()"' % self.name, file=buf) rx_init = re.compile('init\((.*)\):') @@ -215,16 +215,16 @@ # some extra code for a Node's __init__ method name = mo.group(1) cur = classes[name] - return sorted(classes.values(), key=lambda n: n.name) + return sorted(list(classes.values()), key=lambda n: n.name) def main(): prologue, epilogue = load_boilerplate(sys.argv[-1]) - print prologue - print + print((prologue)) + print(()) classes = parse_spec(SPEC) for info in classes: - print info.gen_source() - print epilogue + print((info.gen_source())) + print((epilogue)) if __name__ == "__main__": main() @@ -287,6 +287,6 @@ return "Expression(%s)" % (repr(self.node)) ### EPILOGUE -for name, obj in globals().items(): +for name, obj in list(globals().items()): if isinstance(obj, type) and issubclass(obj, Node): nodes[name.lower()] = obj Index: Doc/tools/mkhowto =================================================================== --- Doc/tools/mkhowto (revision 54264) +++ Doc/tools/mkhowto (working copy) @@ -65,11 +65,11 @@ def usage(options, file): - print >>file, __doc__ % options + print(__doc__ % options, file=file) def error(options, message, err=2): - print >>sys.stderr, message - print >>sys.stderr + print(message, file=sys.stderr) + print(file=sys.stderr) usage(options, sys.stderr) sys.exit(2) @@ -132,7 +132,7 @@ try: return getattr(self, key) except AttributeError: - raise KeyError, key + raise KeyError(key) def parse(self, args): opts, args = getopt.getopt(args, "Hi:a:s:lDkqr:", @@ -289,7 +289,7 @@ if not imgs: self.warning( "Could not locate support images of type %s." - % `self.options.image_type`) + % repr(self.options.image_type)) for fn in imgs: new_fn = os.path.join(self.builddir, os.path.basename(fn)) shutil.copyfile(fn, new_fn) @@ -534,7 +534,7 @@ def message(self, msg): msg = "+++ " + msg if not self.options.quiet: - print msg + print(msg) self.log(msg + "\n") def warning(self, msg): Index: Doc/tools/mkmodindex =================================================================== --- Doc/tools/mkmodindex (revision 54264) +++ Doc/tools/mkmodindex (working copy) @@ -49,7 +49,7 @@ def usage(self): program = os.path.basename(sys.argv[0]) - print __doc__ % {"program": program} + print(__doc__ % {"program": program}) links = [ ('author', 'acks.html', 'Acknowledgements'), @@ -143,8 +143,8 @@ if options.outputfile == "-": sys.stderr.write("%s: %d index nodes\n" % (program, num_nodes)) else: - print - print "%s: %d index nodes" % (program, num_nodes) + print() + print("%s: %d index nodes" % (program, num_nodes)) PLAT_DISCUSS = """ Index: Doc/tools/getversioninfo =================================================================== --- Doc/tools/getversioninfo (revision 54264) +++ Doc/tools/getversioninfo (working copy) @@ -68,4 +68,4 @@ "\\setshortversion{%s}\n" % (release, releaseinfo, shortversion)) -print release + releaseinfo +print(release + releaseinfo) Index: Doc/lib/libitertools.tex =================================================================== --- Doc/lib/libitertools.tex (revision 54264) +++ Doc/lib/libitertools.tex (working copy) @@ -459,7 +459,7 @@ # is differencing with a range so that consecutive numbers all appear in # same group. >>> data = [ 1, 4,5,6, 10, 15,16,17,18, 22, 25,26,27,28] ->>> for k, g in groupby(enumerate(data), lambda (i,x):i-x): +>>> for k, g in groupby(enumerate(data), lambda t:t[0]-t[1]): ... print map(operator.itemgetter(1), g) ... [1] Index: Doc/ref/ref5.tex =================================================================== --- Doc/ref/ref5.tex (revision 54264) +++ Doc/ref/ref5.tex (working copy) @@ -535,11 +535,7 @@ Formal parameters using the syntax \samp{*identifier} or \samp{**identifier} cannot be used as positional argument slots or -as keyword argument names. Formal parameters using the syntax -\samp{(sublist)} cannot be used as keyword argument names; the -outermost sublist corresponds to a single unnamed argument slot, and -the argument value is assigned to the sublist using the usual tuple -assignment rules after all other parameter processing is done. +as keyword argument names. A call always returns some value, possibly \code{None}, unless it raises an exception. How this value is computed depends on the type @@ -1039,7 +1035,8 @@ \end{verbatim} See section \ref{function} for the syntax of parameter lists. Note -that functions created with lambda forms cannot contain statements. +that functions created with lambda forms cannot contain statements +or annotations. \label{lambda} \section{Expression lists\label{exprlists}} Index: Doc/ref/ref7.tex =================================================================== --- Doc/ref/ref7.tex (revision 54264) +++ Doc/ref/ref7.tex (working copy) @@ -381,6 +381,7 @@ \begin{productionlist} \production{funcdef} {[\token{decorators}] "def" \token{funcname} "(" [\token{parameter_list}] ")" + ["->" \token{expression}]? ":" \token{suite}} \production{decorators} {\token{decorator}+} @@ -390,15 +391,14 @@ {\token{identifier} ("." \token{identifier})*} \production{parameter_list} {(\token{defparameter} ",")*} - \productioncont{(~~"*" \token{identifier} [, "**" \token{identifier}]} - \productioncont{ | "**" \token{identifier}} + \productioncont{(~~"*" [\token{parameter}] ("," \token{defparameter})*} + \productioncont{ [, "**" \token{parameter}]} + \productioncont{ | "**" \token{parameter}} \productioncont{ | \token{defparameter} [","] )} + \production{parameter} + {\token{identifier} [":" \token{expression}]} \production{defparameter} {\token{parameter} ["=" \token{expression}]} - \production{sublist} - {\token{parameter} ("," \token{parameter})* [","]} - \production{parameter} - {\token{identifier} | "(" \token{sublist} ")"} \production{funcname} {\token{identifier}} \end{productionlist} @@ -435,14 +435,14 @@ func = f1(arg)(f2(func)) \end{verbatim} -When one or more top-level parameters have the form \var{parameter} +When one or more parameters have the form \var{parameter} \code{=} \var{expression}, the function is said to have ``default parameter values.'' For a parameter with a default value, the corresponding argument may be omitted from a call, in which case the parameter's default value is substituted. If a -parameter has a default value, all following parameters must also have -a default value --- this is a syntactic restriction that is not -expressed by the grammar. +parameter has a default value, all following parameters up until the +``\code{*}'' must also have a default value --- this is a syntactic +restriction that is not expressed by the grammar. \indexiii{default}{parameter}{value} \strong{Default parameter values are evaluated when the function @@ -473,8 +473,22 @@ positional parameters, defaulting to the empty tuple. If the form ``\code{**identifier}'' is present, it is initialized to a new dictionary receiving any excess keyword arguments, defaulting to a -new empty dictionary. +new empty dictionary. Parameters after ``\code{*}'' or ``\code{*identifier}'' +are keyword-only parameters and may only be passed used keyword arguments. +Parameters may have annotations of the form ``\code{: expression}'' +following the parameter name. Any parameter may have an annotation even +those of the form ``\code{*identifier}'' or ``\code{**identifier}''. +Functions may have "return" annotation of the form ``\code{-> expression}'' +after the parameter list. These annotations can be any valid Python +expression and are evaluated when the function definition is executed. +Annotations may be evaluated in a different order than they appear in the +source code. The presence of annotations does not change the semantics of a +function. The annotation values are available as values of a dictionary +keyed by the parameters' names in the ``\member{__annotations__}'' +attribute of the function object. +\indexii{function}{annotations} + It is also possible to create anonymous functions (functions not bound to a name), for immediate use in expressions. This uses lambda forms, described in section~\ref{lambda}. Note that the lambda form is @@ -482,7 +496,7 @@ defined in a ``\keyword{def}'' statement can be passed around or assigned to another name just like a function defined by a lambda form. The ``\keyword{def}'' form is actually more powerful since it -allows the execution of multiple statements. +allows the execution of multiple statements and annotations. \indexii{lambda}{form} \strong{Programmer's note:} Functions are first-class objects. A Index: Doc/ref/ref3.tex =================================================================== --- Doc/ref/ref3.tex (revision 54264) +++ Doc/ref/ref3.tex (working copy) @@ -498,8 +498,9 @@ \lineiii{__closure__}{\code{None} or a tuple of cells that contain bindings for the function's free variables.}{Read-only} - \lineiii{__annotations__}{A dict containing annotations of parameters.} - {Writable} + \lineiii{__annotations__}{A dict containing annotations of parameters. + The keys of the dict are the parameter names, or ``\code{'return'}'' + for the return annotation, if provided.}{Writable} \lineiii{__kwdefaults__}{A dict containing defaults for keyword-only parameters.}{Writable} Index: Doc/Makefile =================================================================== --- Doc/Makefile (revision 54264) +++ Doc/Makefile (working copy) @@ -73,9 +73,6 @@ # commontex/patchlevel.tex in their dependencies. RELEASE=$(shell $(PYTHON) tools/getversioninfo) -PYTHON= python -DVIPS= dvips -N0 -t $(PAPER) - # This is ugly! The issue here is that there are two different levels # in the directory tree at which we execute mkhowto, so we can't # define it just once using a relative path (at least not with the @@ -87,6 +84,10 @@ # (e.g. OpenBSD needs package gmake installed; use gmake instead of make) PWD=$(shell pwd) +PYTHON= $(PWD)/../python +DVIPS= dvips -N0 -t $(PAPER) + + # (The trailing colon in the value is needed; TeX places its default # set of paths at the location of the empty string in the path list.) TEXINPUTS=$(PWD)/commontex: Index: Lib/wave.py =================================================================== --- Lib/wave.py (revision 54264) +++ Lib/wave.py (working copy) @@ -374,7 +374,8 @@ def getcompname(self): return self._compname - def setparams(self, (nchannels, sampwidth, framerate, nframes, comptype, compname)): + def setparams(self, params): + nchannels, sampwidth, framerate, nframes, comptype, compname = params if self._datawritten: raise Error, 'cannot change parameters after starting to write' self.setnchannels(nchannels) Index: Lib/symbol.py =================================================================== --- Lib/symbol.py (revision 54264) +++ Lib/symbol.py (working copy) @@ -18,86 +18,82 @@ funcdef = 261 parameters = 262 typedargslist = 263 -tname = 264 -tfpdef = 265 -tfplist = 266 -varargslist = 267 -vname = 268 -vfpdef = 269 -vfplist = 270 -stmt = 271 -simple_stmt = 272 -small_stmt = 273 -expr_stmt = 274 -augassign = 275 -del_stmt = 276 -pass_stmt = 277 -flow_stmt = 278 -break_stmt = 279 -continue_stmt = 280 -return_stmt = 281 -yield_stmt = 282 -raise_stmt = 283 -import_stmt = 284 -import_name = 285 -import_from = 286 -import_as_name = 287 -dotted_as_name = 288 -import_as_names = 289 -dotted_as_names = 290 -dotted_name = 291 -global_stmt = 292 -nonlocal_stmt = 293 -assert_stmt = 294 -compound_stmt = 295 -if_stmt = 296 -while_stmt = 297 -for_stmt = 298 -try_stmt = 299 -with_stmt = 300 -with_var = 301 -except_clause = 302 -suite = 303 -testlist_safe = 304 -old_test = 305 -old_lambdef = 306 -test = 307 -or_test = 308 -and_test = 309 -not_test = 310 -comparison = 311 -comp_op = 312 -expr = 313 -xor_expr = 314 -and_expr = 315 -shift_expr = 316 -arith_expr = 317 -term = 318 -factor = 319 -power = 320 -atom = 321 -listmaker = 322 -testlist_gexp = 323 -lambdef = 324 -trailer = 325 -subscriptlist = 326 -subscript = 327 -sliceop = 328 -exprlist = 329 -testlist = 330 -dictsetmaker = 331 -classdef = 332 -arglist = 333 -argument = 334 -list_iter = 335 -list_for = 336 -list_if = 337 -gen_iter = 338 -gen_for = 339 -gen_if = 340 -testlist1 = 341 -encoding_decl = 342 -yield_expr = 343 +tfpdef = 264 +varargslist = 265 +vfpdef = 266 +stmt = 267 +simple_stmt = 268 +small_stmt = 269 +expr_stmt = 270 +augassign = 271 +del_stmt = 272 +pass_stmt = 273 +flow_stmt = 274 +break_stmt = 275 +continue_stmt = 276 +return_stmt = 277 +yield_stmt = 278 +raise_stmt = 279 +import_stmt = 280 +import_name = 281 +import_from = 282 +import_as_name = 283 +dotted_as_name = 284 +import_as_names = 285 +dotted_as_names = 286 +dotted_name = 287 +global_stmt = 288 +nonlocal_stmt = 289 +assert_stmt = 290 +compound_stmt = 291 +if_stmt = 292 +while_stmt = 293 +for_stmt = 294 +try_stmt = 295 +with_stmt = 296 +with_var = 297 +except_clause = 298 +suite = 299 +testlist_safe = 300 +old_test = 301 +old_lambdef = 302 +test = 303 +or_test = 304 +and_test = 305 +not_test = 306 +comparison = 307 +comp_op = 308 +expr = 309 +xor_expr = 310 +and_expr = 311 +shift_expr = 312 +arith_expr = 313 +term = 314 +factor = 315 +power = 316 +atom = 317 +listmaker = 318 +testlist_gexp = 319 +lambdef = 320 +trailer = 321 +subscriptlist = 322 +subscript = 323 +sliceop = 324 +exprlist = 325 +testlist = 326 +dictsetmaker = 327 +classdef = 328 +arglist = 329 +argument = 330 +list_iter = 331 +list_for = 332 +list_if = 333 +gen_iter = 334 +gen_for = 335 +gen_if = 336 +testlist1 = 337 +encoding_decl = 338 +yield_expr = 339 #--end constants-- sym_name = {} Index: Lib/idlelib/Debugger.py =================================================================== --- Lib/idlelib/Debugger.py (revision 54264) +++ Lib/idlelib/Debugger.py (working copy) @@ -253,7 +253,8 @@ if self.vsource.get(): self.sync_source_line() - def show_frame(self, (frame, lineno)): + def show_frame(self, stackitem): + (frame, lineno) = stackitem self.frame = frame self.show_variables() Index: Lib/idlelib/CallTips.py =================================================================== --- Lib/idlelib/CallTips.py (revision 54264) +++ Lib/idlelib/CallTips.py (working copy) @@ -183,7 +183,6 @@ def t4(*args): "(...)" def t5(a, *args): "(a, ...)" def t6(a, b=None, *args, **kw): "(a, b=None, ..., ***)" - def t7((a, b), c, (d, e)): "(, c, )" class TC(object): "(ai=None, ...)" @@ -194,7 +193,6 @@ def t4(self, *args): "(...)" def t5(self, ai, *args): "(ai, ...)" def t6(self, ai, b=None, *args, **kw): "(ai, b=None, ..., ***)" - def t7(self, (ai, b), c, (d, e)): "(, c, )" def test(tests): ct = CallTips() @@ -215,7 +213,7 @@ print("%d of %d tests failed" % (len(failed), len(tests))) tc = TC() - tests = (t1, t2, t3, t4, t5, t6, t7, - TC, tc.t1, tc.t2, tc.t3, tc.t4, tc.t5, tc.t6, tc.t7) + tests = (t1, t2, t3, t4, t5, t6, + TC, tc.t1, tc.t2, tc.t3, tc.t4, tc.t5, tc.t6) test(tests) Index: Lib/threading.py =================================================================== --- Lib/threading.py (revision 54264) +++ Lib/threading.py (working copy) @@ -128,10 +128,9 @@ # Internal methods used by condition variables - def _acquire_restore(self, (count, owner)): + def _acquire_restore(self, state): self.__block.acquire() - self.__count = count - self.__owner = owner + self.__count, self.__owner = state if __debug__: self._note("%s._acquire_restore()", self) Index: Lib/tokenize.py =================================================================== --- Lib/tokenize.py (revision 54264) +++ Lib/tokenize.py (working copy) @@ -132,7 +132,8 @@ class StopTokenizing(Exception): pass -def printtoken(type, token, (srow, scol), (erow, ecol), line): # for testing +def printtoken(type, token, startrowcol, endrowcol, line): # for testing + (srow, scol), (erow, ecol) = startrowcol, endrowcol print("%d,%d-%d,%d:\t%s\t%s" % \ (srow, scol, erow, ecol, tok_name[type], repr(token))) Index: Lib/sunau.py =================================================================== --- Lib/sunau.py (revision 54264) +++ Lib/sunau.py (working copy) @@ -364,7 +364,8 @@ else: return 'not compressed' - def setparams(self, (nchannels, sampwidth, framerate, nframes, comptype, compname)): + def setparams(self, params): + nchannels, sampwidth, framerate, nframes, comptype, compname = params self.setnchannels(nchannels) self.setsampwidth(sampwidth) self.setframerate(framerate) Index: Lib/formatter.py =================================================================== --- Lib/formatter.py (revision 54264) +++ Lib/formatter.py (working copy) @@ -228,7 +228,8 @@ self.align = None self.writer.new_alignment(None) - def push_font(self, (size, i, b, tt)): + def push_font(self, font): + (size, i, b, tt) = font if self.softspace: self.hard_break = self.para_end = self.softspace = 0 self.nospace = 1 Index: Lib/plat-irix5/flp.py =================================================================== --- Lib/plat-irix5/flp.py (revision 54264) +++ Lib/plat-irix5/flp.py (working copy) @@ -327,7 +327,8 @@ # # External - Create a form an link to an instance variable. # -def create_full_form(inst, (fdata, odatalist)): +def create_full_form(inst, formdata): + (fdata, odatalist) = formdata form = create_form(fdata) exec('inst.'+fdata.Name+' = form\n') for odata in odatalist: @@ -337,7 +338,8 @@ # External - Merge a form into an existing form in an instance # variable. # -def merge_full_form(inst, form, (fdata, odatalist)): +def merge_full_form(inst, form, formdata): + (fdata, odatalist) = formdata exec('inst.'+fdata.Name+' = form\n') if odatalist[0].Class != FL.BOX: raise error, 'merge_full_form() expects FL.BOX as first obj' Index: Lib/plat-irix6/flp.py =================================================================== --- Lib/plat-irix6/flp.py (revision 54264) +++ Lib/plat-irix6/flp.py (working copy) @@ -326,7 +326,8 @@ # # External - Create a form an link to an instance variable. # -def create_full_form(inst, (fdata, odatalist)): +def create_full_form(inst, formdata): + (fdata, odatalist) = formdata form = create_form(fdata) exec('inst.'+fdata.Name+' = form\n') for odata in odatalist: @@ -336,7 +337,8 @@ # External - Merge a form into an existing form in an instance # variable. # -def merge_full_form(inst, form, (fdata, odatalist)): +def merge_full_form(inst, form, formdata): + (fdata, odatalist) = formdata exec('inst.'+fdata.Name+' = form\n') if odatalist[0].Class != FL.BOX: raise error, 'merge_full_form() expects FL.BOX as first obj' Index: Lib/modulefinder.py =================================================================== --- Lib/modulefinder.py (revision 54264) +++ Lib/modulefinder.py (working copy) @@ -279,7 +279,8 @@ self.msgout(3, "import_module ->", m) return m - def load_module(self, fqname, fp, pathname, (suffix, mode, type)): + def load_module(self, fqname, fp, pathname, stuff): + (suffix, mode, type) = stuff self.msgin(2, "load_module", fqname, fp and "fp", pathname) if type == imp.PKG_DIRECTORY: m = self.load_package(fqname, pathname) Index: Lib/compiler/symbols.py =================================================================== --- Lib/compiler/symbols.py (revision 54264) +++ Lib/compiler/symbols.py (working copy) @@ -286,12 +286,9 @@ def _do_arguments(self, scope, arguments): for node in arguments: - if isinstance(node, ast.SimpleArg): - scope.add_param(node.name) - if node.annotation: - self.visit(node.annotation, scope) - else: - self._do_arguments(scope, node.args) + scope.add_param(node.name) + if node.annotation: + self.visit(node.annotation, scope) def handle_free_vars(self, scope, parent): parent.add_child(scope) Index: Lib/compiler/pycodegen.py =================================================================== --- Lib/compiler/pycodegen.py (revision 54264) +++ Lib/compiler/pycodegen.py (working copy) @@ -414,13 +414,9 @@ def _visit_argument_annotations(self, arguments): for arg in arguments: - if isinstance(arg, ast.SimpleArg): - if arg.annotation: - self.visit(arg.annotation) - yield arg.name - else: - for name in self._visit_argument_annotations(arg.args): - yield name + if arg.annotation: + self.visit(arg.annotation) + yield arg.name def _visit_kwarg_annotations(self, kwargs): for kwarg in kwargs: @@ -970,7 +966,7 @@ level = node.level if level == 0 and not self.graph.checkFlag(CO_FUTURE_ABSIMPORT): level = -1 - fromlist = map(lambda (name, alias): name, node.names) + fromlist = [name for name, alias in node.names] if VERSION > 1: self.emit('LOAD_CONST', level) self.emit('LOAD_CONST', tuple(fromlist)) @@ -1367,8 +1363,8 @@ else: name = func.name - args, hasTupleArg = generateArgList(func.arguments) - kwonlyargs = generateKwonlyArgList(func.kwonlyargs) + args = [arg.name for arg in func.arguments] + kwonlyargs = [kw.arg.name for kw in func.kwonlyargs] self.graph = pyassem.PyFlowGraph(name, func.filename, args, kwonlyargs=kwonlyargs, optimized=1) @@ -1385,8 +1381,6 @@ if func.kwargs: self.graph.setFlag(CO_VARKEYWORDS) self.set_lineno(func) - if hasTupleArg: - self.generateArgUnpack(func.arguments) def get_module(self): return self.module @@ -1397,13 +1391,6 @@ self.emit('LOAD_CONST', None) self.emit('RETURN_VALUE') - def generateArgUnpack(self, args): - for i in range(len(args)): - arg = args[i] - if isinstance(arg, ast.NestedArgs): - self.emit('LOAD_FAST', '.%d' % (i * 2)) - self.unpackSequence(tuple(_nested_names(arg))) - def unpackSequence(self, tup): if VERSION > 1: self.emit('UNPACK_SEQUENCE', len(tup)) @@ -1489,24 +1476,6 @@ self.emit("LOAD_CONST", klass.doc) self.storeName('__doc__') -def generateArgList(arglist): - """Generate an arg list marking TupleArgs""" - args = [] - extra = [] - count = 0 - for i in range(len(arglist)): - elt = arglist[i] - if isinstance(elt, ast.SimpleArg): - args.append(elt.name) - elif isinstance(elt, ast.NestedArgs): - t = tuple(_nested_names(elt)) - args.append(TupleArg(i * 2, t)) - extra.extend(misc.flatten(t)) - count = count + 1 - else: - raise ValueError, "unexpect argument type:", elt - return args + extra, count - def _nested_names(elt): for arg in elt.args: if isinstance(arg, ast.SimpleArg): @@ -1514,13 +1483,6 @@ elif isinstance(arg, ast.NestedArgs): yield tuple(_nested_names(arg)) -def generateKwonlyArgList(keywordOnlyArgs): - kwonlyargs = [] - for elt in keywordOnlyArgs: - assert isinstance(elt, ast.Kwarg) - kwonlyargs.append(elt.arg.name) - return kwonlyargs - def findOp(node): """Find the op (DELETE, LOAD, STORE) in an AssTuple tree""" v = OpFinder() Index: Lib/compiler/transformer.py =================================================================== --- Lib/compiler/transformer.py (revision 54264) +++ Lib/compiler/transformer.py (working copy) @@ -332,24 +332,12 @@ def vfpdef(self, nodelist): raise WalkerError - def vfplist(self, nodelist): - raise WalkerError - - def vname(self, nodelist): - raise WalkerError - def typedargslist(self, nodelist): raise WalkerError def tfpdef(self, nodelist): raise WalkerError - def tfplist(self, nodelist): - raise WalkerError - - def tname(self, nodelist): - raise WalkerError - def dotted_name(self, nodelist): raise WalkerError @@ -647,9 +635,9 @@ for i in range(2, len(nodelist), 2): right = self.com_node(nodelist[i]) if nodelist[i-1][0] == token.LEFTSHIFT: - node = LeftShift([node, right], lineno=nodelist[1][2]) + node = LeftShift(node, right, lineno=nodelist[1][2]) elif nodelist[i-1][0] == token.RIGHTSHIFT: - node = RightShift([node, right], lineno=nodelist[1][2]) + node = RightShift(node, right, lineno=nodelist[1][2]) else: raise ValueError, "unexpected token: %s" % nodelist[i-1][0] return node @@ -659,9 +647,9 @@ for i in range(2, len(nodelist), 2): right = self.com_node(nodelist[i]) if nodelist[i-1][0] == token.PLUS: - node = Add([node, right], lineno=nodelist[1][2]) + node = Add(node, right, lineno=nodelist[1][2]) elif nodelist[i-1][0] == token.MINUS: - node = Sub([node, right], lineno=nodelist[1][2]) + node = Sub(node, right, lineno=nodelist[1][2]) else: raise ValueError, "unexpected token: %s" % nodelist[i-1][0] return node @@ -672,13 +660,13 @@ right = self.com_node(nodelist[i]) t = nodelist[i-1][0] if t == token.STAR: - node = Mul([node, right]) + node = Mul(node, right) elif t == token.SLASH: - node = Div([node, right]) + node = Div(node, right) elif t == token.PERCENT: - node = Mod([node, right]) + node = Mod(node, right) elif t == token.DOUBLESLASH: - node = FloorDiv([node, right]) + node = FloorDiv(node, right) else: raise ValueError, "unexpected token: %s" % t node.lineno = nodelist[1][2] @@ -703,7 +691,7 @@ for i in range(1, len(nodelist)): elt = nodelist[i] if elt[0] == token.DOUBLESTAR: - return Power([node, self.com_node(nodelist[i+1])], + return Power(node, self.com_node(nodelist[i+1]), lineno=elt[2]) node = self.com_apply_trailer(node, elt) @@ -788,10 +776,10 @@ return Discard(Const(None)) def keywordonlyargs(self, nodelist): - # (',' tname ['=' test])* + # (',' tfpdef ['=' test])* # ^^^ # ------+ - # tname and vname are handled. + # tfpdef and vfpdef are handled. kwonlyargs = [] i = 0 while i < len(nodelist): @@ -805,33 +793,24 @@ i += 2 if node[0] == token.DOUBLESTAR: return kwonlyargs, i - elif node[0] in (symbol.vname, symbol.tname): + elif node[0] in (symbol.vfpdef, symbol.tfpdef): lineno = extractLineNo(node) - kwarg = Kwarg(self._simplearg(node), default, lineno=lineno) + kwarg = Kwarg(self.com_tfpdef(node), default, lineno=lineno) kwonlyargs.append(kwarg) i += 2 return kwonlyargs, i - def _simplearg(self, node): - # tname: NAME [':' test] - # vname: NAME - assert node[0] == symbol.vname or node[0] == symbol.tname - name = node[1][1] - lineno = node[1][2] - assert isinstance(name, str) - if len(node) > 2: - annotation = self.com_node(node[3]) - else: - annotation = None - return SimpleArg(name, annotation, lineno) - def com_arglist(self, nodelist): - # varargslist: - # (fpdef ['=' test] ',')* - # ('*' [NAME] (',' NAME '=' test)* [',' '**' NAME] | '**' NAME) - # | fpdef ['=' test] (',' fpdef ['=' test])* [','] - # fpdef: NAME | '(' fplist ')' - # fplist: fpdef (',' fpdef)* [','] + # typedargslist: ((tfpdef ['=' test] ',')* + # ('*' [tfpdef] (',' tfpdef ['=' test])* [',' '**' tfpdef] + # | '**' tfpdef) + # | tfpdef ['=' test] (',' tfpdef ['=' test])* [',']) + # tfpdef: NAME [':' test] + # varargslist: ((vfpdef ['=' test] ',')* + # ('*' [vfpdef] (',' vfpdef ['=' test])* [',' '**' vfpdef] + # | '**' vfpdef) + # | vfpdef ['=' test] (',' vfpdef ['=' test])* [',']) + # vfpdef: NAME arguments = [] kwonlyargs = [] defaults = [] @@ -843,15 +822,15 @@ if node[0] == token.STAR or node[0] == token.DOUBLESTAR: if node[0] == token.STAR: node = nodelist[i+1] - if node[0] in (symbol.tname, symbol.vname): # vararg - arguments.append(self._simplearg(node)) + if node[0] in (symbol.tfpdef, symbol.vfpdef): # vararg + arguments.append(self.com_tfpdef(node)) flags = flags | CO_VARARGS i = i + 3 else: # no vararg assert node[0] == token.COMMA i += 2 if i < len(nodelist) and \ - nodelist[i][0] in (symbol.tname, symbol.vname): + nodelist[i][0] in (symbol.tfpdef, symbol.vfpdef): kwonlyargs, skip = self.keywordonlyargs(nodelist[i:]) i += skip @@ -862,12 +841,12 @@ node = nodelist[i+1] else: raise ValueError, "unexpected token: %s" % t - arguments.append(self._simplearg(node)) + arguments.append(self.com_tfpdef(node)) flags = flags | CO_VARKEYWORDS break - # tfpdef: tname | '(' tfplist ')' + # tfpdef: NAME [':' test] arguments.append(self.com_tfpdef(node)) i = i + 1 @@ -885,23 +864,18 @@ return arguments, defaults, kwonlyargs, flags def com_tfpdef(self, node): - # tfpdef: tname | '(' tfplist ')' - # def f((x)): -- x is not nested - while node[1][0] == token.LPAR and len(node[2]) == 2: - node = node[2][1] - if node[1][0] == token.LPAR: - return NestedArgs(self.com_tfplist(node[2])) - return self._simplearg(node[1]) + # tfpdef: NAME [':' test] + # vfpdef: NAME + assert node[0] == symbol.vfpdef or node[0] == symbol.tfpdef + name = node[1][1] + lineno = node[1][2] + assert isinstance(name, str) + if len(node) > 2: + annotation = self.com_node(node[3]) + else: + annotation = None + return Arg(name, annotation, lineno) - def com_tfplist(self, node): - # tfplist: tfpdef (',' tfpdef)* [','] - if len(node) == 2: - return self.com_tfpdef(node[1]), - list = [] - for i in range(1, len(node), 2): - list.append(self.com_tfpdef(node[i])) - return tuple(list) - def com_dotted_name(self, node): # String together the dotted names and return the string name = "" Index: Lib/compiler/ast.py =================================================================== --- Lib/compiler/ast.py (revision 54264) +++ Lib/compiler/ast.py (working copy) @@ -52,9 +52,9 @@ def __repr__(self): return "Expression(%s)" % (repr(self.node)) - +() class Add(Node): - def __init__(self, (left, right), lineno=None): + def __init__(self, left, right, lineno=None): self.left = left self.right = right self.lineno = lineno @@ -66,7 +66,7 @@ return self.left, self.right def __repr__(self): - return "Add((%s, %s))" % (repr(self.left), repr(self.right)) + return "Add(%s, %s)" % (repr(self.left), repr(self.right)) class And(Node): def __init__(self, nodes, lineno=None): @@ -84,6 +84,27 @@ def __repr__(self): return "And(%s)" % (repr(self.nodes),) +class Arg(Node): + def __init__(self, name, annotation, lineno=None): + self.name = name + self.annotation = annotation + self.lineno = lineno + + def getChildren(self): + children = [] + children.append(self.name) + children.append(self.annotation) + return tuple(children) + + def getChildNodes(self): + nodelist = [] + if self.annotation is not None: + nodelist.append(self.annotation) + return tuple(nodelist) + + def __repr__(self): + return "Arg(%s, %s)" % (repr(self.name), repr(self.annotation)) + class AssAttr(Node): def __init__(self, expr, attrname, flags, lineno=None): self.expr = expr @@ -430,7 +451,7 @@ return "Discard(%s)" % (repr(self.expr),) class Div(Node): - def __init__(self, (left, right), lineno=None): + def __init__(self, left, right, lineno=None): self.left = left self.right = right self.lineno = lineno @@ -442,10 +463,10 @@ return self.left, self.right def __repr__(self): - return "Div((%s, %s))" % (repr(self.left), repr(self.right)) + return "Div(%s, %s)" % (repr(self.left), repr(self.right)) class FloorDiv(Node): - def __init__(self, (left, right), lineno=None): + def __init__(self, left, right, lineno=None): self.left = left self.right = right self.lineno = lineno @@ -457,7 +478,7 @@ return self.left, self.right def __repr__(self): - return "FloorDiv((%s, %s))" % (repr(self.left), repr(self.right)) + return "FloorDiv(%s, %s)" % (repr(self.left), repr(self.right)) class For(Node): def __init__(self, assign, list, body, else_, lineno=None): @@ -554,7 +575,7 @@ def __init__(self, code, lineno=None): self.code = code self.lineno = lineno - self.arguments = [SimpleArg('.0', None)] + self.arguments = [Arg('.0', None)] self.varargs = self.kwargs = None self.kwonlyargs = () @@ -790,7 +811,7 @@ return "Lambda(%s, %s, %s, %s, %s)" % (repr(self.arguments), repr(self.defaults), repr(self.kwonlyargs), repr(self.flags), repr(self.code)) class LeftShift(Node): - def __init__(self, (left, right), lineno=None): + def __init__(self, left, right, lineno=None): self.left = left self.right = right self.lineno = lineno @@ -802,7 +823,7 @@ return self.left, self.right def __repr__(self): - return "LeftShift((%s, %s))" % (repr(self.left), repr(self.right)) + return "LeftShift(%s, %s)" % (repr(self.left), repr(self.right)) class List(Node): def __init__(self, nodes, lineno=None): @@ -880,7 +901,7 @@ return "ListCompIf(%s)" % (repr(self.test),) class Mod(Node): - def __init__(self, (left, right), lineno=None): + def __init__(self, left, right, lineno=None): self.left = left self.right = right self.lineno = lineno @@ -892,7 +913,7 @@ return self.left, self.right def __repr__(self): - return "Mod((%s, %s))" % (repr(self.left), repr(self.right)) + return "Mod(%s, %s)" % (repr(self.left), repr(self.right)) class Module(Node): def __init__(self, doc, node, lineno=None): @@ -910,7 +931,7 @@ return "Module(%s, %s)" % (repr(self.doc), repr(self.node)) class Mul(Node): - def __init__(self, (left, right), lineno=None): + def __init__(self, left, right, lineno=None): self.left = left self.right = right self.lineno = lineno @@ -922,7 +943,7 @@ return self.left, self.right def __repr__(self): - return "Mul((%s, %s))" % (repr(self.left), repr(self.right)) + return "Mul(%s, %s)" % (repr(self.left), repr(self.right)) class Name(Node): def __init__(self, name, lineno=None): @@ -938,22 +959,6 @@ def __repr__(self): return "Name(%s)" % (repr(self.name),) -class NestedArgs(Node): - def __init__(self, args, lineno=None): - self.args = args - self.lineno = lineno - - def getChildren(self): - return tuple(flatten(self.args)) - - def getChildNodes(self): - nodelist = [] - nodelist.extend(flatten_nodes(self.args)) - return tuple(nodelist) - - def __repr__(self): - return "NestedArgs(%s)" % (repr(self.args),) - class Not(Node): def __init__(self, expr, lineno=None): self.expr = expr @@ -998,7 +1003,7 @@ return "Pass()" class Power(Node): - def __init__(self, (left, right), lineno=None): + def __init__(self, left, right, lineno=None): self.left = left self.right = right self.lineno = lineno @@ -1010,7 +1015,7 @@ return self.left, self.right def __repr__(self): - return "Power((%s, %s))" % (repr(self.left), repr(self.right)) + return "Power(%s, %s)" % (repr(self.left), repr(self.right)) class Raise(Node): def __init__(self, expr1, expr2, expr3, lineno=None): @@ -1054,7 +1059,7 @@ return "Return(%s)" % (repr(self.value),) class RightShift(Node): - def __init__(self, (left, right), lineno=None): + def __init__(self, left, right, lineno=None): self.left = left self.right = right self.lineno = lineno @@ -1066,7 +1071,7 @@ return self.left, self.right def __repr__(self): - return "RightShift((%s, %s))" % (repr(self.left), repr(self.right)) + return "RightShift(%s, %s)" % (repr(self.left), repr(self.right)) class Set(Node): def __init__(self, items, lineno=None): @@ -1084,27 +1089,6 @@ def __repr__(self): return "Set(%s)" % (repr(self.items),) -class SimpleArg(Node): - def __init__(self, name, annotation, lineno=None): - self.name = name - self.annotation = annotation - self.lineno = lineno - - def getChildren(self): - children = [] - children.append(self.name) - children.append(self.annotation) - return tuple(children) - - def getChildNodes(self): - nodelist = [] - if self.annotation is not None: - nodelist.append(self.annotation) - return tuple(nodelist) - - def __repr__(self): - return "SimpleArg(%s, %s)" % (repr(self.name), repr(self.annotation)) - class Slice(Node): def __init__(self, expr, flags, lower, upper, lineno=None): self.expr = expr @@ -1166,7 +1150,7 @@ return "Stmt(%s)" % (repr(self.nodes),) class Sub(Node): - def __init__(self, (left, right), lineno=None): + def __init__(self, left, right, lineno=None): self.left = left self.right = right self.lineno = lineno @@ -1178,7 +1162,7 @@ return self.left, self.right def __repr__(self): - return "Sub((%s, %s))" % (repr(self.left), repr(self.right)) + return "Sub(%s, %s)" % (repr(self.left), repr(self.right)) class Subscript(Node): def __init__(self, expr, flags, subs, lineno=None): Index: Lib/inspect.py =================================================================== --- Lib/inspect.py (revision 54264) +++ Lib/inspect.py (working copy) @@ -367,8 +367,8 @@ def getmoduleinfo(path): """Get the module name, suffix, mode, and module type for a given file.""" filename = os.path.basename(path) - suffixes = map(lambda (suffix, mode, mtype): - (-len(suffix), suffix, mode, mtype), imp.get_suffixes()) + suffixes = [(-len(suffix), suffix, mode, mtype) + for suffix, mode, mtype in imp.get_suffixes()] suffixes.sort() # try longest suffixes first, in case they overlap for neglen, suffix, mode, mtype in suffixes: if filename[neglen:] == suffix: @@ -569,7 +569,7 @@ self.passline = False self.last = 1 - def tokeneater(self, type, token, (srow, scol), (erow, ecol), line): + def tokeneater(self, type, token, startrowcol, endrowcol, line): if not self.started: # look for the first "def", "class" or "lambda" if token in ("def", "class", "lambda"): @@ -579,7 +579,7 @@ self.passline = True # skip to the end of the line elif type == tokenize.NEWLINE: self.passline = False # stop skipping when a NEWLINE is seen - self.last = srow + self.last = startrowcol[0] if self.islambda: # lambdas always end at the first NEWLINE raise EndOfBlock elif self.passline: @@ -699,40 +699,6 @@ kwonlyargs = list(names[nargs:nargs+nkwargs]) step = 0 - # The following acrobatics are for anonymous (tuple) arguments. - for i in range(nargs): - if args[i][:1] in ('', '.'): - stack, remain, count = [], [], [] - while step < len(code): - op = ord(code[step]) - step = step + 1 - if op >= dis.HAVE_ARGUMENT: - opname = dis.opname[op] - value = ord(code[step]) + ord(code[step+1])*256 - step = step + 2 - if opname in ('UNPACK_TUPLE', 'UNPACK_SEQUENCE'): - remain.append(value) - count.append(value) - elif opname == 'STORE_FAST': - stack.append(names[value]) - - # Special case for sublists of length 1: def foo((bar)) - # doesn't generate the UNPACK_TUPLE bytecode, so if - # `remain` is empty here, we have such a sublist. - if not remain: - stack[0] = [stack[0]] - break - else: - remain[-1] = remain[-1] - 1 - while remain[-1] == 0: - remain.pop() - size = count.pop() - stack[-size:] = [stack[-size:]] - if not remain: break - remain[-1] = remain[-1] - 1 - if not remain: break - args[i] = stack[0] - nargs += nkwargs varargs = None if co.co_flags & CO_VARARGS: @@ -767,8 +733,8 @@ def getfullargspec(func): """Get the names and default values of a function's arguments. - A tuple of seven things is returned: (args, varargs, kwonlyargs, - kwonlydefaults, varkw, defaults, annotations). + A tuple of seven things is returned: (args, varargs, varkw, defaults, + kwonlyargs, kwonlydefaults, annotations). 'args' is a list of the argument names (it may contain nested lists). 'varargs' and 'varkw' are the names of the * and ** arguments or None. 'defaults' is an n-tuple of the default values of the last n arguments. Index: Lib/pdb.py =================================================================== --- Lib/pdb.py (revision 54264) +++ Lib/pdb.py (working copy) @@ -174,13 +174,12 @@ print('--Return--', file=self.stdout) self.interaction(frame, None) - def user_exception(self, frame, (exc_type, exc_value, exc_traceback)): + def user_exception(self, frame, exc_info): """This function is called if an exception occurs, but only if we are to stop at or just below this level.""" - frame.f_locals['__exception__'] = exc_type, exc_value - if type(exc_type) == type(''): - exc_type_name = exc_type - else: exc_type_name = exc_type.__name__ + (exc_type, exc_value, exc_traceback) = exc_info + frame.f_locals['__exception__'] = exc_type, exc_value + exc_type_name = exc_type.__name__ print(exc_type_name + ':', _saferepr(exc_value), file=self.stdout) self.interaction(frame, exc_traceback) Index: Lib/pydoc.py =================================================================== --- Lib/pydoc.py (revision 54264) +++ Lib/pydoc.py (working copy) @@ -172,11 +172,10 @@ def classify_class_attrs(object): """Wrap inspect.classify_class_attrs, with fixup for data descriptors.""" - def fixup((name, kind, cls, value)): + for (name, kind, cls, value) in inspect.classify_class_attrs(object): if inspect.isdatadescriptor(value): kind = 'data descriptor' - return name, kind, cls, value - return map(fixup, inspect.classify_class_attrs(object)) + yield name, kind, cls, value # ----------------------------------------------------- module manipulation @@ -229,11 +228,9 @@ class ErrorDuringImport(Exception): """Errors that occurred while trying to import something to document it.""" - def __init__(self, filename, (exc, value, tb)): + def __init__(self, filename, exc_info): self.filename = filename - self.exc = exc - self.value = value - self.tb = tb + self.exc, self.value, self.tb = exc_info def __str__(self): exc = self.exc @@ -503,8 +500,9 @@ """Make a link for a module.""" return '%s' % (object.__name__, object.__name__) - def modpkglink(self, (name, path, ispackage, shadowed)): + def modpkglink(self, modpkginfo): """Make a link for a module or package to display in an index.""" + (name, path, ispackage, shadowed) = modpkginfo if shadowed: return self.grey(name) if path: @@ -663,12 +661,12 @@ 'Package Contents', '#ffffff', '#aa55cc', contents) elif modules: contents = self.multicolumn( - modules, lambda (key, value), s=self: s.modulelink(value)) + modules, lambda t: self.modulelink(t[1])) result = result + self.bigsection( 'Modules', '#fffff', '#aa55cc', contents) if classes: - classlist = map(lambda (key, value): value, classes) + classlist = [value for (key, value) in classes] contents = [ self.formattree(inspect.getclasstree(classlist, 1), name)] for key, value in classes: @@ -769,8 +767,10 @@ push('\n') return attrs - attrs = filter(lambda (name, kind, cls, value): visiblename(name), - classify_class_attrs(object)) + attrs = [(name, kind, cls, value) + for name, kind, cls, value in classify_class_attrs(object) + if visiblename(name)] + mdict = {} for key, kind, homecls, value in attrs: mdict[key] = anchor = '#' + name + '-' + key @@ -1071,7 +1071,7 @@ 'PACKAGE CONTENTS', join(modpkgs, '\n')) if classes: - classlist = map(lambda (key, value): value, classes) + classlist = [value for key, value in classes] contents = [self.formattree( inspect.getclasstree(classlist, 1), name)] for key, value in classes: @@ -1175,8 +1175,10 @@ name, mod, maxlen=70, doc=doc) + '\n') return attrs - attrs = filter(lambda (name, kind, cls, value): visiblename(name), - classify_class_attrs(object)) + attrs = [(name, kind, cls, value) + for name, kind, cls, value in classify_class_attrs(object) + if visiblename(name)] + while attrs: if mro: thisclass = mro.popleft() Index: Lib/aifc.py =================================================================== --- Lib/aifc.py (revision 54264) +++ Lib/aifc.py (working copy) @@ -665,7 +665,8 @@ ## raise Error, 'cannot change parameters after starting to write' ## self._version = version - def setparams(self, (nchannels, sampwidth, framerate, nframes, comptype, compname)): + def setparams(self, params): + nchannels, sampwidth, framerate, nframes, comptype, compname = params if self._nframeswritten: raise Error, 'cannot change parameters after starting to write' if comptype not in ('NONE', 'ULAW', 'ALAW', 'G722'): Index: Lib/bdb.py =================================================================== --- Lib/bdb.py (revision 54264) +++ Lib/bdb.py (working copy) @@ -151,7 +151,7 @@ """This method is called when a return trap is set here.""" pass - def user_exception(self, frame, (exc_type, exc_value, exc_traceback)): + def user_exception(self, frame, exc_info): """This method is called if an exception occurs, but only if we are to stop at or just below this level.""" pass Index: Lib/pprint.py =================================================================== --- Lib/pprint.py (revision 54264) +++ Lib/pprint.py (working copy) @@ -249,7 +249,10 @@ try: items = sorted(items) except TypeError: - items = sorted(items, key=lambda (k, v): (str(type(k)), k, v)) + def sortkey(item): + key, value = item + return str(type(key)), key, value + items = sorted(items, key=sortkey) for k, v in items: krepr, kreadable, krecur = saferepr(k, context, maxlevels, level) vrepr, vreadable, vrecur = saferepr(v, context, maxlevels, level) Index: Lib/test/test_math.py =================================================================== --- Lib/test/test_math.py (revision 54264) +++ Lib/test/test_math.py (working copy) @@ -105,10 +105,11 @@ def testFrexp(self): self.assertRaises(TypeError, math.frexp) - def testfrexp(name, (mant, exp), (emant, eexp)): + def testfrexp(name, result, expected): + (mant, exp), (emant, eexp) = result, expected if abs(mant-emant) > eps or exp != eexp: self.fail('%s returned %r, expected %r'%\ - (name, (mant, exp), (emant,eexp))) + (name, result, expected)) testfrexp('frexp(-1)', math.frexp(-1), (-0.5, 1)) testfrexp('frexp(0)', math.frexp(0), (0, 0)) @@ -145,10 +146,11 @@ def testModf(self): self.assertRaises(TypeError, math.modf) - def testmodf(name, (v1, v2), (e1, e2)): + def testmodf(name, result, expected): + (v1, v2), (e1, e2) = result, expected if abs(v1-e1) > eps or abs(v2-e2): self.fail('%s returned %r, expected %r'%\ - (name, (v1,v2), (e1,e2))) + (name, result, expected)) testmodf('modf(1.5)', math.modf(1.5), (0.5, 1.0)) testmodf('modf(-1.5)', math.modf(-1.5), (-0.5, -1.0)) Index: Lib/test/test_inspect.py =================================================================== --- Lib/test/test_inspect.py (revision 54264) +++ Lib/test/test_inspect.py (working copy) @@ -116,11 +116,11 @@ def test_previous_frame(self): args, varargs, varkw, locals = inspect.getargvalues(mod.fr.f_back) - self.assertEqual(args, ['a', 'b', 'c', 'd', ['e', ['f']]]) + self.assertEqual(args, ['a', 'b', 'c', 'd', 'e', 'f']) self.assertEqual(varargs, 'g') self.assertEqual(varkw, 'h') self.assertEqual(inspect.formatargvalues(args, varargs, varkw, locals), - '(a=7, b=8, c=9, d=3, (e=4, (f=5,)), *g=(), **h={})') + '(a=7, b=8, c=9, d=3, e=4, f=5, *g=(), **h={})') class GetSourceBase(unittest.TestCase): # Subclasses must override. @@ -321,9 +321,9 @@ self.assertArgSpecEquals(mod.eggs, ['x', 'y'], formatted = '(x, y)') self.assertArgSpecEquals(mod.spam, - ['a', 'b', 'c', 'd', ['e', ['f']]], - 'g', 'h', (3, (4, (5,))), - '(a, b, c, d=3, (e, (f,))=(4, (5,)), *g, **h)') + ['a', 'b', 'c', 'd', 'e', 'f'], + 'g', 'h', (3, 4, 5), + '(a, b, c, d=3, e=4, f=5, *g, **h)') def test_getargspec_method(self): class A(object): @@ -331,13 +331,6 @@ pass self.assertArgSpecEquals(A.m, ['self']) - def test_getargspec_sublistofone(self): - def sublistOfOne((foo,)): return 1 - self.assertArgSpecEquals(sublistOfOne, [['foo']]) - - def fakeSublistOfOne((foo)): return 1 - self.assertArgSpecEquals(fakeSublistOfOne, ['foo']) - def test_classify_newstyle(self): class A(object): Index: Lib/test/test_complex_args.py =================================================================== --- Lib/test/test_complex_args.py (revision 54264) +++ Lib/test/test_complex_args.py (working copy) @@ -1,91 +0,0 @@ - -import unittest -from test import test_support - -class ComplexArgsTestCase(unittest.TestCase): - - def check(self, func, expected, *args): - self.assertEqual(func(*args), expected) - - # These functions are tested below as lambdas too. If you add a function test, - # also add a similar lambda test. - - def test_func_parens_no_unpacking(self): - def f(((((x))))): return x - self.check(f, 1, 1) - # Inner parens are elided, same as: f(x,) - def f(((x)),): return x - self.check(f, 2, 2) - - def test_func_1(self): - def f(((((x),)))): return x - self.check(f, 3, (3,)) - def f(((((x)),))): return x - self.check(f, 4, (4,)) - def f(((((x))),)): return x - self.check(f, 5, (5,)) - def f(((x),)): return x - self.check(f, 6, (6,)) - - def test_func_2(self): - def f(((((x)),),)): return x - self.check(f, 2, ((2,),)) - - def test_func_3(self): - def f((((((x)),),),)): return x - self.check(f, 3, (((3,),),)) - - def test_func_complex(self): - def f((((((x)),),),), a, b, c): return x, a, b, c - self.check(f, (3, 9, 8, 7), (((3,),),), 9, 8, 7) - - def f(((((((x)),)),),), a, b, c): return x, a, b, c - self.check(f, (3, 9, 8, 7), (((3,),),), 9, 8, 7) - - def f(a, b, c, ((((((x)),)),),)): return a, b, c, x - self.check(f, (9, 8, 7, 3), 9, 8, 7, (((3,),),)) - - # Duplicate the tests above, but for lambda. If you add a lambda test, - # also add a similar function test above. - - def test_lambda_parens_no_unpacking(self): - f = lambda (((((x))))): x - self.check(f, 1, 1) - # Inner parens are elided, same as: f(x,) - f = lambda ((x)),: x - self.check(f, 2, 2) - - def test_lambda_1(self): - f = lambda (((((x),)))): x - self.check(f, 3, (3,)) - f = lambda (((((x)),))): x - self.check(f, 4, (4,)) - f = lambda (((((x))),)): x - self.check(f, 5, (5,)) - f = lambda (((x),)): x - self.check(f, 6, (6,)) - - def test_lambda_2(self): - f = lambda (((((x)),),)): x - self.check(f, 2, ((2,),)) - - def test_lambda_3(self): - f = lambda ((((((x)),),),)): x - self.check(f, 3, (((3,),),)) - - def test_lambda_complex(self): - f = lambda (((((x)),),),), a, b, c: (x, a, b, c) - self.check(f, (3, 9, 8, 7), (((3,),),), 9, 8, 7) - - f = lambda ((((((x)),)),),), a, b, c: (x, a, b, c) - self.check(f, (3, 9, 8, 7), (((3,),),), 9, 8, 7) - - f = lambda a, b, c, ((((((x)),)),),): (a, b, c, x) - self.check(f, (9, 8, 7, 3), 9, 8, 7, (((3,),),)) - - -def test_main(): - test_support.run_unittest(ComplexArgsTestCase) - -if __name__ == "__main__": - test_main() Index: Lib/test/test_itertools.py =================================================================== --- Lib/test/test_itertools.py (revision 54264) +++ Lib/test/test_itertools.py (working copy) @@ -855,7 +855,7 @@ # is differencing with a range so that consecutive numbers all appear in # same group. >>> data = [ 1, 4,5,6, 10, 15,16,17,18, 22, 25,26,27,28] ->>> for k, g in groupby(enumerate(data), lambda (i,x):i-x): +>>> for k, g in groupby(enumerate(data), lambda t:t[0]-t[1]): ... print(map(operator.itemgetter(1), g)) ... [1] Index: Lib/test/test_threadsignals.py =================================================================== --- Lib/test/test_threadsignals.py (revision 54264) +++ Lib/test/test_threadsignals.py (working copy) @@ -14,7 +14,7 @@ signalled_all=thread.allocate_lock() -def registerSignals((for_usr1, for_usr2, for_alrm)): +def registerSignals(for_usr1, for_usr2, for_alrm): usr1 = signal.signal(signal.SIGUSR1, for_usr1) usr2 = signal.signal(signal.SIGUSR2, for_usr2) alrm = signal.signal(signal.SIGALRM, for_alrm) @@ -74,11 +74,11 @@ signal.SIGUSR2 : {'tripped': 0, 'tripped_by': 0 }, signal.SIGALRM : {'tripped': 0, 'tripped_by': 0 } } - oldsigs = registerSignals((handle_signals, handle_signals, handle_signals)) + oldsigs = registerSignals(handle_signals, handle_signals, handle_signals) try: run_unittest(ThreadSignals) finally: - registerSignals(oldsigs) + registerSignals(*oldsigs) if __name__ == '__main__': test_main() Index: Lib/test/test_compile.py =================================================================== --- Lib/test/test_compile.py (revision 54264) +++ Lib/test/test_compile.py (working copy) @@ -124,29 +124,9 @@ exec(code, g) self.assertEqual(g['f'](5), 0) - def test_complex_args(self): - - def comp_args((a, b)): - return a,b - self.assertEqual(comp_args((1, 2)), (1, 2)) - - def comp_args((a, b)=(3, 4)): - return a, b - self.assertEqual(comp_args((1, 2)), (1, 2)) - self.assertEqual(comp_args(), (3, 4)) - - def comp_args(a, (b, c)): - return a, b, c - self.assertEqual(comp_args(1, (2, 3)), (1, 2, 3)) - - def comp_args(a=2, (b, c)=(3, 4)): - return a, b, c - self.assertEqual(comp_args(1, (2, 3)), (1, 2, 3)) - self.assertEqual(comp_args(), (2, 3, 4)) - def test_argument_order(self): try: - exec('def f(a=1, (b, c)): pass') + exec('def f(a=1, b): pass') self.fail("non-default args after default") except SyntaxError: pass @@ -393,19 +373,6 @@ del d[..., ...] self.assertEqual((Ellipsis, Ellipsis) in d, False) - def test_annotation_limit(self): - # 16 bits are available for # of annotations, and the - # tuple of annotations names is counted, hence 65534 - # is the max. Ensure the result of too many annotations is a - # SyntaxError. - s = "def f((%s)): pass" - s %= ', '.join('a%d:%d' % (i,i) for i in xrange(65535)) - self.assertRaises(SyntaxError, compile, s, '?', 'exec') - # Test that the max # of annotations compiles. - s = "def f((%s)): pass" - s %= ', '.join('a%d:%d' % (i,i) for i in xrange(65534)) - compile(s, '?', 'exec') - def test_main(): test_support.run_unittest(TestSpecifics) Index: Lib/test/test_sort.py =================================================================== --- Lib/test/test_sort.py (revision 54264) +++ Lib/test/test_sort.py (working copy) @@ -184,7 +184,7 @@ def test_stability(self): data = [(random.randrange(100), i) for i in xrange(200)] copy = data[:] - data.sort(key=lambda (x,y): x) # sort on the random first field + data.sort(key=lambda t: t[0]) # sort on the random first field copy.sort() # sort using both fields self.assertEqual(data, copy) # should get the same result Index: Lib/test/test_compiler.py =================================================================== --- Lib/test/test_compiler.py (revision 54264) +++ Lib/test/test_compiler.py (working copy) @@ -51,7 +51,8 @@ compiler.compile(buf, basename, "exec") except Exception as e: args = list(e.args) - args[0] += "[in file %s]" % basename + if args: + args[0] += "[in file %s]" % basename e.args = tuple(args) raise @@ -129,15 +130,6 @@ dct = {} exec(c, dct) self.assertEquals(dct.get('result'), 3) - c = compiler.compile('def g((a, b)):\n' - ' def f(): return a + b\n' - ' return f()\n' - 'result = g((1, 2))', - '', - 'exec') - dct = {} - exec(c, dct) - self.assertEquals(dct.get('result'), 3) def testGenExp(self): c = compiler.compile('list((i,j) for i in range(3) if i < 3' @@ -149,7 +141,7 @@ def testFuncAnnotations(self): testdata = [ ('def f(a: 1): pass', {'a': 1}), - ('''def f(a, (b:1, c:2, d), e:3=4, f=5, + ('''def f(a, b:1, c:2, d, e:3=4, f=5, *g:6, h:7, i=8, j:9=10, **k:11) -> 12: pass ''', {'b': 1, 'c': 2, 'e': 3, 'g': 6, 'h': 7, 'j': 9, 'k': 11, 'return': 12}), Index: Lib/test/test_scope.py =================================================================== --- Lib/test/test_scope.py (revision 54264) +++ Lib/test/test_scope.py (working copy) @@ -323,13 +323,6 @@ self.assertEqual(makeReturner2(a=11)()['a'], 11) - def makeAddPair((a, b)): - def addPair((c, d)): - return (a + c, b + d) - return addPair - - self.assertEqual(makeAddPair((1, 2))((100, 200)), (101,202)) - def testScopeOfGlobalStmt(self): # Examples posted by Samuele Pedroni to python-dev on 3/1/2001 Index: Lib/test/inspect_fodder.py =================================================================== --- Lib/test/inspect_fodder.py (revision 54264) +++ Lib/test/inspect_fodder.py (working copy) @@ -5,7 +5,7 @@ # line 5 # line 7 -def spam(a, b, c, d=3, (e, (f,))=(4, (5,)), *g, **h): +def spam(a, b, c, d=3, e=4, f=5, *g, **h): eggs(b + d, c + f) # line 11 Index: Lib/test/inspect_fodder2.py =================================================================== --- Lib/test/inspect_fodder2.py (revision 54264) +++ Lib/test/inspect_fodder2.py (working copy) @@ -60,8 +60,8 @@ # line 61 multiline_sig = [ - lambda (x, - y): x+y, + lambda x, \ + y: x+y, None, ] Index: Lib/test/test_grammar.py =================================================================== --- Lib/test/test_grammar.py (revision 54264) +++ Lib/test/test_grammar.py (working copy) @@ -143,51 +143,32 @@ ### decorators: decorator+ ### parameters: '(' [typedargslist] ')' ### typedargslist: ((tfpdef ['=' test] ',')* - ### ('*' [tname] (',' tname ['=' test])* [',' '**' tname] | '**' tname) + ### ('*' [tfpdef] (',' tfpdef ['=' test])* [',' '**' tfpdef] | '**' tfpdef) ### | tfpdef ['=' test] (',' tfpdef ['=' test])* [',']) - ### tname: NAME [':' test] - ### tfpdef: tname | '(' tfplist ')' - ### tfplist: tfpdef (',' tfpdef)* [','] + ### tfpdef: NAME [':' test] ### varargslist: ((vfpdef ['=' test] ',')* - ### ('*' [vname] (',' vname ['=' test])* [',' '**' vname] | '**' vname) + ### ('*' [vfpdef] (',' vfpdef ['=' test])* [',' '**' vfpdef] | '**' vfpdef) ### | vfpdef ['=' test] (',' vfpdef ['=' test])* [',']) - ### vname: NAME - ### vfpdef: vname | '(' vfplist ')' - ### vfplist: vfpdef (',' vfpdef)* [','] + ### vfpdef: NAME def f1(): pass f1() f1(*()) f1(*(), **{}) def f2(one_argument): pass def f3(two, arguments): pass - def f4(two, (compound, (argument, list))): pass - def f5((compound, first), two): pass self.assertEquals(f2.__code__.co_varnames, ('one_argument',)) self.assertEquals(f3.__code__.co_varnames, ('two', 'arguments')) - if sys.platform.startswith('java'): - self.assertEquals(f4.__code__.co_varnames, - ('two', '(compound, (argument, list))', 'compound', 'argument', - 'list',)) - self.assertEquals(f5.__code__.co_varnames, - ('(compound, first)', 'two', 'compound', 'first')) - else: - self.assertEquals(f4.__code__.co_varnames, - ('two', '.1', 'compound', 'argument', 'list')) - self.assertEquals(f5.__code__.co_varnames, - ('.0', 'two', 'compound', 'first')) def a1(one_arg,): pass def a2(two, args,): pass def v0(*rest): pass def v1(a, *rest): pass def v2(a, b, *rest): pass - def v3(a, (b, c), *rest): return a, b, c, rest f1() f2(1) f2(1,) f3(1, 2) f3(1, 2,) - f4(1, (2, (3, 4))) v0() v0(1) v0(1,) @@ -202,17 +183,7 @@ v2(1,2,3) v2(1,2,3,4) v2(1,2,3,4,5,6,7,8,9,0) - v3(1,(2,3)) - v3(1,(2,3),4) - v3(1,(2,3),4,5,6,7,8,9,0) - # ceval unpacks the formal arguments into the first argcount names; - # thus, the names nested inside tuples must appear after these names. - if sys.platform.startswith('java'): - self.assertEquals(v3.__code__.co_varnames, ('a', '(b, c)', 'rest', 'b', 'c')) - else: - self.assertEquals(v3.__code__.co_varnames, ('a', '.1', 'rest', 'b', 'c')) - self.assertEquals(v3(1, (2, 3), 4), (1, 2, 3, (4,))) def d01(a=1): pass d01() d01(1) @@ -285,10 +256,6 @@ d22v(*(1, 2, 3, 4)) d22v(1, 2, *(3, 4, 5)) d22v(1, *(2, 3), **{'d': 4}) - def d31v((x)): pass - d31v(1) - def d32v((x,)): pass - d32v((1,)) # keyword only argument tests def pos0key1(*, key): return key pos0key1(key=100) @@ -311,12 +278,12 @@ self.assertEquals(f.__annotations__, {'x': float}) def f(x, y:1+2): pass self.assertEquals(f.__annotations__, {'y': 3}) - def f(a, (b:1, c:2, d)): pass + def f(a, b:1, c:2, d): pass self.assertEquals(f.__annotations__, {'b': 1, 'c': 2}) - def f(a, (b:1, c:2, d), e:3=4, f=5, *g:6): pass + def f(a, b:1, c:2, d, e:3=4, f=5, *g:6): pass self.assertEquals(f.__annotations__, {'b': 1, 'c': 2, 'e': 3, 'g': 6}) - def f(a, (b:1, c:2, d), e:3=4, f=5, *g:6, h:7, i=8, j:9=10, + def f(a, b:1, c:2, d, e:3=4, f=5, *g:6, h:7, i=8, j:9=10, **k:11) -> 12: pass self.assertEquals(f.__annotations__, {'b': 1, 'c': 2, 'e': 3, 'g': 6, 'h': 7, 'j': 9, Index: Lib/cgitb.py =================================================================== --- Lib/cgitb.py (revision 54264) +++ Lib/cgitb.py (working copy) @@ -94,10 +94,11 @@ lasttoken = token return vars -def html((etype, evalue, etb), context=5): +def html(einfo, context=5): """Return a nice HTML document describing a given traceback.""" import os, types, time, traceback, linecache, inspect, pydoc + etype, evalue, etb = einfo if type(etype) is types.ClassType: etype = etype.__name__ pyver = 'Python ' + sys.version.split()[0] + ': ' + sys.executable @@ -185,10 +186,11 @@ --> ''' % ''.join(traceback.format_exception(etype, evalue, etb)) -def text((etype, evalue, etb), context=5): +def text(einfo, context=5): """Return a plain text document describing a given traceback.""" import os, types, time, traceback, linecache, inspect, pydoc + etype, evalue, etb = einfo if type(etype) is types.ClassType: etype = etype.__name__ pyver = 'Python ' + sys.version.split()[0] + ': ' + sys.executable Index: Lib/urlparse.py =================================================================== --- Lib/urlparse.py (revision 54264) +++ Lib/urlparse.py (working copy) @@ -220,16 +220,18 @@ _parse_cache[key] = v return v -def urlunparse((scheme, netloc, url, params, query, fragment)): +def urlunparse(components): """Put a parsed URL back together again. This may result in a slightly different, but equivalent URL, if the URL that was parsed originally had redundant delimiters, e.g. a ? with an empty query (the draft states that these are equivalent).""" + (scheme, netloc, url, params, query, fragment) = components if params: url = "%s;%s" % (url, params) return urlunsplit((scheme, netloc, url, query, fragment)) -def urlunsplit((scheme, netloc, url, query, fragment)): +def urlunsplit(components): + (scheme, netloc, url, query, fragment) = components if netloc or (scheme and scheme in uses_netloc and url[:2] != '//'): if url and url[:1] != '/': url = '/' + url url = '//' + (netloc or '') + url Index: Lib/plat-mac/findertools.py =================================================================== --- Lib/plat-mac/findertools.py (revision 54264) +++ Lib/plat-mac/findertools.py (working copy) @@ -296,8 +296,9 @@ return _getlocation(object_alias) return _setlocation(object_alias, pos) -def _setlocation(object_alias, (x, y)): +def _setlocation(object_alias, location): """_setlocation: Set the location of the icon for the object.""" + (x, y) = location finder = _getfinder() args = {} attrs = {} @@ -438,8 +439,9 @@ return _getwindowsize(folder_alias) return _setwindowsize(folder_alias, size) -def _setwindowsize(folder_alias, (w, h)): +def _setwindowsize(folder_alias, size): """Set the size of a Finder window for folder to (w, h)""" + (w, h) = size finder = _getfinder() args = {} attrs = {} @@ -489,8 +491,9 @@ pos = (pos.h, pos.v) return _setwindowposition(folder_alias, pos) -def _setwindowposition(folder_alias, (x, y)): +def _setwindowposition(folder_alias, position): """Set the size of a Finder window for folder to (w, h).""" + (x, y) = position finder = _getfinder() args = {} attrs = {} Index: Lib/binhex.py =================================================================== --- Lib/binhex.py (revision 54264) +++ Lib/binhex.py (working copy) @@ -170,7 +170,8 @@ del self.ofp class BinHex: - def __init__(self, (name, finfo, dlen, rlen), ofp): + def __init__(self, name_finfo_dlen_rlen, ofp): + (name, finfo, dlen, rlen) = name_finfo_dlen_rlen if type(ofp) == type(''): ofname = ofp ofp = open(ofname, 'w') Index: Lib/imputil.py =================================================================== --- Lib/imputil.py (revision 54264) +++ Lib/imputil.py (working copy) @@ -278,7 +278,10 @@ setattr(parent, modname, module) return module - def _process_result(self, (ispkg, code, values), fqname): + def _process_result(self, result, fqname): + # unpack result + (ispkg, code, values) = result + # did get_code() return an actual module? (rather than a code object) is_module = isinstance(code, _ModuleType) Index: Modules/parsermodule.c =================================================================== --- Modules/parsermodule.c (revision 54264) +++ Modules/parsermodule.c (working copy) @@ -854,7 +854,7 @@ VALIDATER(class); VALIDATER(node); VALIDATER(parameters); VALIDATER(suite); VALIDATER(testlist); VALIDATER(varargslist); -VALIDATER(vfpdef); VALIDATER(vfplist); +VALIDATER(vfpdef); VALIDATER(stmt); VALIDATER(simple_stmt); VALIDATER(expr_stmt); VALIDATER(power); VALIDATER(del_stmt); @@ -863,7 +863,7 @@ VALIDATER(import_name); VALIDATER(import_from); VALIDATER(global_stmt); VALIDATER(list_if); VALIDATER(assert_stmt); VALIDATER(list_for); -VALIDATER(compound_stmt); VALIDATER(vname); +VALIDATER(compound_stmt); VALIDATER(while); VALIDATER(for); VALIDATER(try); VALIDATER(except_clause); VALIDATER(test); VALIDATER(and_test); @@ -1120,18 +1120,18 @@ } -/* validate either vname or tname. - * vname: NAME - * tname: NAME [':' test] +/* validate either vfpdef or tfpdef. + * vfpdef: NAME + * tfpdef: NAME [':' test] */ static int -validate_vname(node *tree) +validate_vfpdef(node *tree) { int nch = NCH(tree); - if (TYPE(tree) == vname) { + if (TYPE(tree) == vfpdef) { return nch == 1 && validate_name(CHILD(tree, 0), NULL); } - else if (TYPE(tree) == tname) { + else if (TYPE(tree) == tfpdef) { if (nch == 1) { return validate_name(CHILD(tree, 0), NULL); } @@ -1144,8 +1144,8 @@ return 0; } -/* '*' vname (',' vname ['=' test])* [',' '**' vname] | '**' vname - * ..or tname in place of vname. vname: NAME; tname: NAME [':' test] +/* '*' vfpdef (',' vfpdef ['=' test])* [',' '**' vfpdef] | '**' vfpdef + * ..or tfpdef in place of vfpdef. vfpdef: NAME; tfpdef: NAME [':' test] */ static int validate_varargslist_trailer(node *tree, int start) @@ -1161,27 +1161,27 @@ sym = TYPE(CHILD(tree, start)); if (sym == STAR) { /* - * '*' vname (',' vname ['=' test])* [',' '**' vname] | '**' vname + * '*' vfpdef (',' vfpdef ['=' test])* [',' '**' vfpdef] | '**' vfpdef */ if (nch-start == 2) - res = validate_vname(CHILD(tree, start+1)); + res = validate_vfpdef(CHILD(tree, start+1)); else if (nch-start == 5 && TYPE(CHILD(tree, start+2)) == COMMA) - res = (validate_vname(CHILD(tree, start+1)) + res = (validate_vfpdef(CHILD(tree, start+1)) && validate_comma(CHILD(tree, start+2)) && validate_doublestar(CHILD(tree, start+3)) - && validate_vname(CHILD(tree, start+4))); + && validate_vfpdef(CHILD(tree, start+4))); else { - /* skip over vname (',' vname ['=' test])* */ + /* skip over vfpdef (',' vfpdef ['=' test])* */ i = start + 1; - if (TYPE(CHILD(tree, i)) == vname || - TYPE(CHILD(tree, i)) == tname) { /* skip over vname or tname */ + if (TYPE(CHILD(tree, i)) == vfpdef || + TYPE(CHILD(tree, i)) == tfpdef) { /* skip over vfpdef or tfpdef */ i += 1; } - while (res && i+1 < nch) { /* validate (',' vname ['=' test])* */ + while (res && i+1 < nch) { /* validate (',' vfpdef ['=' test])* */ res = validate_comma(CHILD(tree, i)); if (TYPE(CHILD(tree, i+1)) == DOUBLESTAR) break; - res = res && validate_vname(CHILD(tree, i+1)); + res = res && validate_vfpdef(CHILD(tree, i+1)); if (res && i+2 < nch && TYPE(CHILD(tree, i+2)) == EQUAL) { res = res && (i+3 < nch) && validate_test(CHILD(tree, i+3)); @@ -1191,9 +1191,9 @@ i += 2; } } - /* [',' '**' vname] */ + /* [',' '**' vfpdef] */ if (res && i+1 < nch && TYPE(CHILD(tree, i+1)) == DOUBLESTAR) { - res = validate_vname(CHILD(tree, i+2)); + res = validate_vfpdef(CHILD(tree, i+2)); } } } @@ -1202,7 +1202,7 @@ * '**' NAME */ if (nch-start == 2) - res = validate_vname(CHILD(tree, start+1)); + res = validate_vfpdef(CHILD(tree, start+1)); } if (!res) err_string("illegal variable argument trailer for varargslist"); @@ -1215,19 +1215,15 @@ * Validate typedargslist or varargslist. * * typedargslist: ((tfpdef ['=' test] ',')* - * ('*' [tname] (',' tname ['=' test])* [',' '**' tname] | - * '**' tname) + * ('*' [tfpdef] (',' tfpdef ['=' test])* [',' '**' tfpdef] | + * '**' tfpdef) * | tfpdef ['=' test] (',' tfpdef ['=' test])* [',']) - * tname: NAME [':' test] - * tfpdef: tname | '(' tfplist ')' - * tfplist: tfpdef (',' tfpdef)* [','] + * tfpdef: NAME [':' test] * varargslist: ((vfpdef ['=' test] ',')* - * ('*' [vname] (',' vname ['=' test])* [',' '**' vname] | - * '**' vname) + * ('*' [vfpdef] (',' vfpdef ['=' test])* [',' '**' vfpdef] | + * '**' vfpdef) * | vfpdef ['=' test] (',' vfpdef ['=' test])* [',']) - * vname: NAME - * vfpdef: vname | '(' vfplist ')' - * vfplist: vfpdef (',' vfpdef)* [','] + * vfpdef: NAME * */ static int @@ -1238,92 +1234,38 @@ TYPE(tree) == typedargslist) && (nch != 0); int sym; + node *ch; + int i = 0; + if (!res) return 0; if (nch < 1) { err_string("varargslist missing child nodes"); return 0; } - sym = TYPE(CHILD(tree, 0)); - if (sym == STAR || sym == DOUBLESTAR) - /* whole thing matches: - * '*' [NAME] (',' NAME ['=' test])* [',' '**' NAME] | '**' NAME - */ - res = validate_varargslist_trailer(tree, 0); - else if (sym == vfpdef || sym == tfpdef) { - int i = 0; - - sym = TYPE(CHILD(tree, nch-1)); - if (sym == vname || sym == tname) { - /* - * (vfpdef ['=' test] ',')+ - * ('*' vname [',' '**' vname] - * | '**' vname) - */ - /* skip over (vfpdef ['=' test] ',')+ */ - while (res && (i+2 <= nch)) { - res = validate_vfpdef(CHILD(tree, i)); - ++i; - if (res && TYPE(CHILD(tree, i)) == EQUAL && (i+2 <= nch)) { - res = (validate_equal(CHILD(tree, i)) - && validate_test(CHILD(tree, i+1))); - if (res) - i += 2; - } - if (res && i < nch) { - res = validate_comma(CHILD(tree, i)); - ++i; - if (res && i < nch - && (TYPE(CHILD(tree, i)) == DOUBLESTAR - || TYPE(CHILD(tree, i)) == STAR)) - break; - } - } - /* .. ('*' [NAME] (',' NAME ['=' test])* [',' '**' NAME] | '**' NAME) - * i --^^^ - */ - if (res) - res = validate_varargslist_trailer(tree, i); - } - else { - /* - * vfpdef ['=' test] (',' vfpdef ['=' test])* [','] - */ - /* strip trailing comma node */ - if (sym == COMMA) { - res = validate_comma(CHILD(tree, nch-1)); - if (!res) - return 0; - --nch; - } - /* - * vfpdef ['=' test] (',' vfpdef ['=' test])* - */ - res = validate_vfpdef(CHILD(tree, 0)); + while (i < nch) { + ch = CHILD(tree, i); + sym = TYPE(ch); + if (sym == vfpdef || sym == tfpdef) { + /* validate (vfpdef ['=' test] ',')+ */ + res = validate_vfpdef(ch); ++i; if (res && (i+2 <= nch) && TYPE(CHILD(tree, i)) == EQUAL) { res = (validate_equal(CHILD(tree, i)) && validate_test(CHILD(tree, i+1))); - i += 2; + if (res) + i += 2; } - /* - * ... (',' vfpdef ['=' test])* - * i ---^^^ - */ - while (res && (nch - i) >= 2) { - res = (validate_comma(CHILD(tree, i)) - && validate_vfpdef(CHILD(tree, i+1))); - i += 2; - if (res && (nch - i) >= 2 && TYPE(CHILD(tree, i)) == EQUAL) { - res = (validate_equal(CHILD(tree, i)) - && validate_test(CHILD(tree, i+1))); - i += 2; - } + if (res && i < nch) { + res = validate_comma(CHILD(tree, i)); + ++i; } - if (res && nch - i != 0) { - res = 0; - err_string("illegal formation for varargslist"); - } + } else if (sym == DOUBLESTAR || sym == STAR) { + res = validate_varargslist_trailer(tree, i); + break; + } else { + res = 0; + err_string("illegal formation for varargslist"); } } return res; @@ -1444,48 +1386,6 @@ return res; } -/* validate_vfpdef() - * - * Validate vfpdef or tfpdef. - * - * vname: NAME - * vfpdef: vname | '(' vfplist ')' - * vfplist: vfpdef (',' vfpdef)* [','] - * - * tname: NAME [':' test] - * tfpdef: tname | '(' tfplist ')' - * tfplist: tfpdef (',' tfpdef)* [','] - * - */ -static int -validate_vfpdef(node *tree) -{ - int nch = NCH(tree); - int typ = TYPE(tree); - int res = typ == vfpdef || typ == tfpdef; - - if (res) { - if (nch == 1) - res = validate_vname(CHILD(tree, 0)); - else if (nch == 3) - res = (validate_lparen(CHILD(tree, 0)) - && validate_vfplist(CHILD(tree, 1)) - && validate_rparen(CHILD(tree, 2))); - else - res = validate_numnodes(tree, 1, "fpdef"); - } - return (res); -} - - -static int -validate_vfplist(node *tree) -{ - return (validate_repeating_list(tree, vfplist, - validate_vfpdef, "vfplist")); -} - - /* simple_stmt | compound_stmt * */