Index: Python/graminit.c =================================================================== --- Python/graminit.c (revision 55289) +++ 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,1330 +394,1326 @@ {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[3] = { - {78, 2}, - {79, 2}, +static arc arcs_26_1[3] = { + {74, 2}, + {75, 2}, {12, 3}, }; -static arc arcs_30_2[4] = { - {78, 2}, - {79, 2}, +static arc arcs_26_2[4] = { + {74, 2}, + {75, 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}, - {80, 5}, + {76, 5}, }; -static arc arcs_30_5[1] = { +static arc arcs_26_5[1] = { {0, 5}, }; -static arc arcs_30_6[1] = { - {80, 7}, +static arc arcs_26_6[1] = { + {76, 7}, }; -static arc arcs_30_7[1] = { +static arc arcs_26_7[1] = { {15, 5}, }; -static state states_30[8] = { - {1, arcs_30_0}, - {3, arcs_30_1}, - {4, 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}, + {3, arcs_26_1}, + {4, 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] = { - {82, 2}, +static arc arcs_27_1[2] = { + {78, 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] = { - {82, 2}, +static arc arcs_28_1[2] = { + {78, 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] = { - {81, 1}, +static arc arcs_29_0[1] = { + {77, 1}, }; -static arc arcs_33_1[2] = { +static arc arcs_29_1[2] = { {28, 2}, {0, 1}, }; -static arc arcs_33_2[2] = { - {81, 1}, +static arc arcs_29_2[2] = { + {77, 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] = { - {83, 1}, +static arc arcs_30_0[1] = { + {79, 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] = { - {84, 1}, +static arc arcs_32_0[1] = { + {80, 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] = { - {85, 1}, +static arc arcs_33_0[1] = { + {81, 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] = { - {86, 1}, +static arc arcs_34_0[1] = { + {82, 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] = { + {83, 1}, + {84, 1}, + {85, 1}, + {86, 1}, {87, 1}, - {88, 1}, - {89, 1}, - {90, 1}, - {91, 1}, {17, 1}, - {92, 1}, + {88, 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] = { - {93, 1}, +static arc arcs_36_0[1] = { + {89, 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] = { - {94, 1}, - {95, 5}, +static arc arcs_36_4[3] = { + {90, 1}, + {91, 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] = { - {96, 1}, +static arc arcs_37_0[1] = { + {92, 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] = { - {95, 5}, +static arc arcs_37_4[2] = { + {91, 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] = { - {97, 1}, +static arc arcs_38_0[1] = { + {93, 1}, }; -static arc arcs_42_1[1] = { - {62, 2}, +static arc arcs_38_1[1] = { + {58, 2}, }; -static arc arcs_42_2[1] = { - {98, 3}, +static arc arcs_38_2[1] = { + {94, 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] = { - {95, 7}, +static arc arcs_38_6[2] = { + {91, 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] = { - {99, 1}, +static arc arcs_39_0[1] = { + {95, 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] = { - {100, 4}, - {101, 5}, +static arc arcs_39_3[2] = { + {96, 4}, + {97, 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] = { - {100, 4}, - {95, 10}, - {101, 5}, +static arc arcs_39_8[4] = { + {96, 4}, + {91, 10}, + {97, 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] = { - {101, 5}, +static arc arcs_39_12[2] = { + {97, 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] = { - {102, 1}, +static arc arcs_40_0[1] = { + {98, 1}, }; -static arc arcs_44_1[1] = { +static arc arcs_40_1[1] = { {22, 2}, }; -static arc arcs_44_2[2] = { - {103, 3}, +static arc arcs_40_2[2] = { + {99, 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] = { - {82, 1}, +static arc arcs_41_0[1] = { + {78, 1}, }; -static arc arcs_45_1[1] = { - {104, 2}, +static arc arcs_41_1[1] = { + {100, 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] = { - {105, 1}, +static arc arcs_42_0[1] = { + {101, 1}, }; -static arc arcs_46_1[2] = { +static arc arcs_42_1[2] = { {22, 2}, {0, 1}, }; -static arc arcs_46_2[2] = { - {82, 3}, +static arc arcs_42_2[2] = { + {78, 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] = { - {106, 3}, +static arc arcs_43_2[1] = { + {102, 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}, - {107, 1}, + {103, 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[2] = { - {108, 1}, - {109, 2}, +static arc arcs_44_0[2] = { + {104, 1}, + {105, 2}, }; -static arc arcs_48_1[2] = { - {93, 3}, +static arc arcs_44_1[2] = { + {89, 3}, {0, 1}, }; -static arc arcs_48_2[1] = { +static arc arcs_44_2[1] = { {0, 2}, }; -static arc arcs_48_3[1] = { - {108, 4}, +static arc arcs_44_3[1] = { + {104, 4}, }; -static arc arcs_48_4[1] = { - {95, 5}, +static arc arcs_44_4[1] = { + {91, 5}, }; -static arc arcs_48_5[1] = { +static arc arcs_44_5[1] = { {22, 2}, }; -static state states_48[6] = { - {2, arcs_48_0}, - {2, arcs_48_1}, - {1, arcs_48_2}, - {1, arcs_48_3}, - {1, arcs_48_4}, - {1, arcs_48_5}, +static state states_44[6] = { + {2, arcs_44_0}, + {2, arcs_44_1}, + {1, arcs_44_2}, + {1, arcs_44_3}, + {1, arcs_44_4}, + {1, arcs_44_5}, }; -static arc arcs_49_0[2] = { - {108, 1}, - {111, 1}, +static arc arcs_45_0[2] = { + {104, 1}, + {107, 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] = { - {112, 1}, +static arc arcs_46_0[1] = { + {108, 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] = { +static arc arcs_46_3[1] = { {22, 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[1] = { - {112, 1}, +static arc arcs_47_0[1] = { + {108, 1}, }; -static arc arcs_51_1[2] = { - {33, 2}, +static arc arcs_47_1[2] = { + {31, 2}, {23, 3}, }; -static arc arcs_51_2[1] = { +static arc arcs_47_2[1] = { {23, 3}, }; -static arc arcs_51_3[1] = { - {110, 4}, +static arc arcs_47_3[1] = { + {106, 4}, }; -static arc arcs_51_4[1] = { +static arc arcs_47_4[1] = { {0, 4}, }; -static state states_51[5] = { - {1, arcs_51_0}, - {2, arcs_51_1}, - {1, arcs_51_2}, - {1, arcs_51_3}, - {1, arcs_51_4}, +static state states_47[5] = { + {1, arcs_47_0}, + {2, arcs_47_1}, + {1, arcs_47_2}, + {1, arcs_47_3}, + {1, arcs_47_4}, }; -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] = { - {119, 1}, +static arc arcs_51_0[1] = { + {115, 1}, }; -static arc arcs_55_1[2] = { - {120, 0}, +static arc arcs_51_1[2] = { + {116, 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] = { + {117, 1}, + {118, 1}, + {119, 1}, + {120, 1}, {121, 1}, {122, 1}, - {123, 1}, - {124, 1}, - {125, 1}, - {126, 1}, - {98, 1}, - {117, 2}, - {127, 3}, + {94, 1}, + {113, 2}, + {123, 3}, }; -static arc arcs_56_1[1] = { +static arc arcs_52_1[1] = { {0, 1}, }; -static arc arcs_56_2[1] = { - {98, 1}, +static arc arcs_52_2[1] = { + {94, 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[2] = { +static arc arcs_53_0[2] = { {29, 1}, - {104, 2}, + {100, 2}, }; -static arc arcs_57_1[1] = { - {104, 2}, +static arc arcs_53_1[1] = { + {100, 2}, }; -static arc arcs_57_2[1] = { +static arc arcs_53_2[1] = { {0, 2}, }; -static state states_57[3] = { - {2, arcs_57_0}, - {1, arcs_57_1}, - {1, arcs_57_2}, +static state states_53[3] = { + {2, arcs_53_0}, + {1, arcs_53_1}, + {1, arcs_53_2}, }; -static arc arcs_58_0[1] = { - {128, 1}, +static arc arcs_54_0[1] = { + {124, 1}, }; -static arc arcs_58_1[2] = { - {129, 0}, +static arc arcs_54_1[2] = { + {125, 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] = { - {130, 1}, +static arc arcs_55_0[1] = { + {126, 1}, }; -static arc arcs_59_1[2] = { - {131, 0}, +static arc arcs_55_1[2] = { + {127, 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] = { - {132, 1}, +static arc arcs_56_0[1] = { + {128, 1}, }; -static arc arcs_60_1[2] = { - {133, 0}, +static arc arcs_56_1[2] = { + {129, 0}, {0, 1}, }; -static state states_60[2] = { - {1, arcs_60_0}, - {2, arcs_60_1}, +static state states_56[2] = { + {1, arcs_56_0}, + {2, arcs_56_1}, }; -static arc arcs_61_0[1] = { - {134, 1}, +static arc arcs_57_0[1] = { + {130, 1}, }; -static arc arcs_61_1[3] = { - {135, 0}, - {136, 0}, +static arc arcs_57_1[3] = { + {131, 0}, + {132, 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] = { - {137, 1}, +static arc arcs_58_0[1] = { + {133, 1}, }; -static arc arcs_62_1[3] = { - {138, 0}, - {139, 0}, +static arc arcs_58_1[3] = { + {134, 0}, + {135, 0}, {0, 1}, }; -static state states_62[2] = { - {1, arcs_62_0}, - {3, arcs_62_1}, +static state states_58[2] = { + {1, arcs_58_0}, + {3, arcs_58_1}, }; -static arc arcs_63_0[1] = { - {140, 1}, +static arc arcs_59_0[1] = { + {136, 1}, }; -static arc arcs_63_1[5] = { +static arc arcs_59_1[5] = { {29, 0}, - {141, 0}, - {142, 0}, - {143, 0}, + {137, 0}, + {138, 0}, + {139, 0}, {0, 1}, }; -static state states_63[2] = { - {1, arcs_63_0}, - {5, arcs_63_1}, +static state states_59[2] = { + {1, arcs_59_0}, + {5, arcs_59_1}, }; -static arc arcs_64_0[4] = { - {138, 1}, - {139, 1}, - {144, 1}, - {145, 2}, +static arc arcs_60_0[4] = { + {134, 1}, + {135, 1}, + {140, 1}, + {141, 2}, }; -static arc arcs_64_1[1] = { - {140, 2}, +static arc arcs_60_1[1] = { + {136, 2}, }; -static arc arcs_64_2[1] = { +static arc arcs_60_2[1] = { {0, 2}, }; -static state states_64[3] = { - {4, arcs_64_0}, - {1, arcs_64_1}, - {1, arcs_64_2}, +static state states_60[3] = { + {4, arcs_60_0}, + {1, arcs_60_1}, + {1, arcs_60_2}, }; -static arc arcs_65_0[1] = { - {146, 1}, +static arc arcs_61_0[1] = { + {142, 1}, }; -static arc arcs_65_1[3] = { - {147, 1}, - {31, 2}, +static arc arcs_61_1[3] = { + {143, 1}, + {30, 2}, {0, 1}, }; -static arc arcs_65_2[1] = { - {140, 3}, +static arc arcs_61_2[1] = { + {136, 3}, }; -static arc arcs_65_3[1] = { +static arc arcs_61_3[1] = { {0, 3}, }; -static state states_65[4] = { - {1, arcs_65_0}, - {3, arcs_65_1}, - {1, arcs_65_2}, - {1, arcs_65_3}, +static state states_61[4] = { + {1, arcs_61_0}, + {3, arcs_61_1}, + {1, arcs_61_2}, + {1, arcs_61_3}, }; -static arc arcs_66_0[7] = { +static arc arcs_62_0[7] = { {13, 1}, - {149, 2}, - {151, 3}, + {145, 2}, + {147, 3}, {19, 4}, - {154, 4}, - {155, 5}, - {79, 4}, + {150, 4}, + {151, 5}, + {75, 4}, }; -static arc arcs_66_1[3] = { - {48, 6}, - {148, 6}, +static arc arcs_62_1[3] = { + {44, 6}, + {144, 6}, {15, 4}, }; -static arc arcs_66_2[2] = { - {148, 7}, - {150, 4}, +static arc arcs_62_2[2] = { + {144, 7}, + {146, 4}, }; -static arc arcs_66_3[2] = { - {152, 8}, - {153, 4}, +static arc arcs_62_3[2] = { + {148, 8}, + {149, 4}, }; -static arc arcs_66_4[1] = { +static arc arcs_62_4[1] = { {0, 4}, }; -static arc arcs_66_5[2] = { - {155, 5}, +static arc arcs_62_5[2] = { + {151, 5}, {0, 5}, }; -static arc arcs_66_6[1] = { +static arc arcs_62_6[1] = { {15, 4}, }; -static arc arcs_66_7[1] = { - {150, 4}, +static arc arcs_62_7[1] = { + {146, 4}, }; -static arc arcs_66_8[1] = { - {153, 4}, +static arc arcs_62_8[1] = { + {149, 4}, }; -static state states_66[9] = { - {7, arcs_66_0}, - {3, arcs_66_1}, - {2, arcs_66_2}, - {2, arcs_66_3}, - {1, arcs_66_4}, - {2, arcs_66_5}, - {1, arcs_66_6}, - {1, arcs_66_7}, - {1, arcs_66_8}, +static state states_62[9] = { + {7, arcs_62_0}, + {3, arcs_62_1}, + {2, arcs_62_2}, + {2, arcs_62_3}, + {1, arcs_62_4}, + {2, arcs_62_5}, + {1, arcs_62_6}, + {1, arcs_62_7}, + {1, arcs_62_8}, }; -static arc arcs_67_0[1] = { +static arc arcs_63_0[1] = { {22, 1}, }; -static arc arcs_67_1[3] = { - {156, 2}, +static arc arcs_63_1[3] = { + {152, 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[3] = { +static arc arcs_64_0[3] = { {13, 1}, - {149, 2}, - {78, 3}, + {145, 2}, + {74, 3}, }; -static arc arcs_68_1[2] = { +static arc arcs_64_1[2] = { {14, 4}, {15, 5}, }; -static arc arcs_68_2[1] = { - {157, 6}, +static arc arcs_64_2[1] = { + {153, 6}, }; -static arc arcs_68_3[1] = { +static arc arcs_64_3[1] = { {19, 5}, }; -static arc arcs_68_4[1] = { +static arc arcs_64_4[1] = { {15, 5}, }; -static arc arcs_68_5[1] = { +static arc arcs_64_5[1] = { {0, 5}, }; -static arc arcs_68_6[1] = { - {150, 5}, +static arc arcs_64_6[1] = { + {146, 5}, }; -static state states_68[7] = { - {3, arcs_68_0}, - {2, arcs_68_1}, - {1, arcs_68_2}, - {1, arcs_68_3}, - {1, arcs_68_4}, - {1, arcs_68_5}, - {1, arcs_68_6}, +static state states_64[7] = { + {3, arcs_64_0}, + {2, arcs_64_1}, + {1, arcs_64_2}, + {1, arcs_64_3}, + {1, arcs_64_4}, + {1, arcs_64_5}, + {1, arcs_64_6}, }; -static arc arcs_69_0[1] = { - {158, 1}, +static arc arcs_65_0[1] = { + {154, 1}, }; -static arc arcs_69_1[2] = { +static arc arcs_65_1[2] = { {28, 2}, {0, 1}, }; -static arc arcs_69_2[2] = { - {158, 1}, +static arc arcs_65_2[2] = { + {154, 1}, {0, 2}, }; -static state states_69[3] = { - {1, arcs_69_0}, - {2, arcs_69_1}, - {2, arcs_69_2}, +static state states_65[3] = { + {1, arcs_65_0}, + {2, arcs_65_1}, + {2, arcs_65_2}, }; -static arc arcs_70_0[2] = { +static arc arcs_66_0[2] = { {22, 1}, {23, 2}, }; -static arc arcs_70_1[2] = { +static arc arcs_66_1[2] = { {23, 2}, {0, 1}, }; -static arc arcs_70_2[3] = { +static arc arcs_66_2[3] = { {22, 3}, - {159, 4}, + {155, 4}, {0, 2}, }; -static arc arcs_70_3[2] = { - {159, 4}, +static arc arcs_66_3[2] = { + {155, 4}, {0, 3}, }; -static arc arcs_70_4[1] = { +static arc arcs_66_4[1] = { {0, 4}, }; -static state states_70[5] = { - {2, arcs_70_0}, - {2, arcs_70_1}, - {3, arcs_70_2}, - {2, arcs_70_3}, - {1, arcs_70_4}, +static state states_66[5] = { + {2, arcs_66_0}, + {2, arcs_66_1}, + {3, arcs_66_2}, + {2, arcs_66_3}, + {1, arcs_66_4}, }; -static arc arcs_71_0[1] = { +static arc arcs_67_0[1] = { {23, 1}, }; -static arc arcs_71_1[2] = { +static arc arcs_67_1[2] = { {22, 2}, {0, 1}, }; -static arc arcs_71_2[1] = { +static arc arcs_67_2[1] = { {0, 2}, }; -static state states_71[3] = { - {1, arcs_71_0}, - {2, arcs_71_1}, - {1, arcs_71_2}, +static state states_67[3] = { + {1, arcs_67_0}, + {2, arcs_67_1}, + {1, arcs_67_2}, }; -static arc arcs_72_0[1] = { - {119, 1}, +static arc arcs_68_0[1] = { + {115, 1}, }; -static arc arcs_72_1[2] = { +static arc arcs_68_1[2] = { {28, 2}, {0, 1}, }; -static arc arcs_72_2[2] = { - {119, 1}, +static arc arcs_68_2[2] = { + {115, 1}, {0, 2}, }; -static state states_72[3] = { - {1, arcs_72_0}, - {2, arcs_72_1}, - {2, arcs_72_2}, +static state states_68[3] = { + {1, arcs_68_0}, + {2, arcs_68_1}, + {2, arcs_68_2}, }; -static arc arcs_73_0[1] = { +static arc arcs_69_0[1] = { {22, 1}, }; -static arc arcs_73_1[2] = { +static arc arcs_69_1[2] = { {28, 2}, {0, 1}, }; -static arc arcs_73_2[2] = { +static arc arcs_69_2[2] = { {22, 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[4] = { +static arc arcs_70_1[4] = { {23, 2}, - {156, 3}, + {152, 3}, {28, 4}, {0, 1}, }; -static arc arcs_74_2[1] = { +static arc arcs_70_2[1] = { {22, 5}, }; -static arc arcs_74_3[1] = { +static arc arcs_70_3[1] = { {0, 3}, }; -static arc arcs_74_4[2] = { +static arc arcs_70_4[2] = { {22, 6}, {0, 4}, }; -static arc arcs_74_5[2] = { +static arc arcs_70_5[2] = { {28, 7}, {0, 5}, }; -static arc arcs_74_6[2] = { +static arc arcs_70_6[2] = { {28, 4}, {0, 6}, }; -static arc arcs_74_7[2] = { +static arc arcs_70_7[2] = { {22, 8}, {0, 7}, }; -static arc arcs_74_8[1] = { +static arc arcs_70_8[1] = { {23, 2}, }; -static state states_74[9] = { - {1, arcs_74_0}, - {4, arcs_74_1}, - {1, arcs_74_2}, - {1, arcs_74_3}, - {2, arcs_74_4}, - {2, arcs_74_5}, - {2, arcs_74_6}, - {2, arcs_74_7}, - {1, arcs_74_8}, +static state states_70[9] = { + {1, arcs_70_0}, + {4, arcs_70_1}, + {1, arcs_70_2}, + {1, arcs_70_3}, + {2, arcs_70_4}, + {2, arcs_70_5}, + {2, arcs_70_6}, + {2, arcs_70_7}, + {1, arcs_70_8}, }; -static arc arcs_75_0[1] = { - {160, 1}, +static arc arcs_71_0[1] = { + {156, 1}, }; -static arc arcs_75_1[1] = { +static arc arcs_71_1[1] = { {19, 2}, }; -static arc arcs_75_2[2] = { +static arc arcs_71_2[2] = { {13, 3}, {23, 4}, }; -static arc arcs_75_3[2] = { +static arc arcs_71_3[2] = { {14, 5}, {15, 6}, }; -static arc arcs_75_4[1] = { +static arc arcs_71_4[1] = { {24, 7}, }; -static arc arcs_75_5[1] = { +static arc arcs_71_5[1] = { {15, 6}, }; -static arc arcs_75_6[1] = { +static arc arcs_71_6[1] = { {23, 4}, }; -static arc arcs_75_7[1] = { +static arc arcs_71_7[1] = { {0, 7}, }; -static state states_75[8] = { - {1, arcs_75_0}, - {1, arcs_75_1}, - {2, arcs_75_2}, - {2, arcs_75_3}, - {1, arcs_75_4}, - {1, arcs_75_5}, - {1, arcs_75_6}, - {1, arcs_75_7}, +static state states_71[8] = { + {1, arcs_71_0}, + {1, arcs_71_1}, + {2, arcs_71_2}, + {2, arcs_71_3}, + {1, arcs_71_4}, + {1, arcs_71_5}, + {1, arcs_71_6}, + {1, arcs_71_7}, }; -static arc arcs_76_0[3] = { - {161, 1}, +static arc arcs_72_0[3] = { + {157, 1}, {29, 2}, - {31, 3}, + {30, 3}, }; -static arc arcs_76_1[2] = { +static arc arcs_72_1[2] = { {28, 4}, {0, 1}, }; -static arc arcs_76_2[1] = { +static arc arcs_72_2[1] = { {22, 5}, }; -static arc arcs_76_3[1] = { +static arc arcs_72_3[1] = { {22, 6}, }; -static arc arcs_76_4[4] = { - {161, 1}, +static arc arcs_72_4[4] = { + {157, 1}, {29, 2}, - {31, 3}, + {30, 3}, {0, 4}, }; -static arc arcs_76_5[2] = { +static arc arcs_72_5[2] = { {28, 7}, {0, 5}, }; -static arc arcs_76_6[1] = { +static arc arcs_72_6[1] = { {0, 6}, }; -static arc arcs_76_7[1] = { - {31, 3}, +static arc arcs_72_7[1] = { + {30, 3}, }; -static state states_76[8] = { - {3, arcs_76_0}, - {2, arcs_76_1}, - {1, arcs_76_2}, - {1, arcs_76_3}, - {4, arcs_76_4}, - {2, arcs_76_5}, - {1, arcs_76_6}, - {1, arcs_76_7}, +static state states_72[8] = { + {3, arcs_72_0}, + {2, arcs_72_1}, + {1, arcs_72_2}, + {1, arcs_72_3}, + {4, arcs_72_4}, + {2, arcs_72_5}, + {1, arcs_72_6}, + {1, arcs_72_7}, }; -static arc arcs_77_0[1] = { +static arc arcs_73_0[1] = { {22, 1}, }; -static arc arcs_77_1[3] = { - {156, 2}, +static arc arcs_73_1[3] = { + {152, 2}, {27, 3}, {0, 1}, }; -static arc arcs_77_2[1] = { +static arc arcs_73_2[1] = { {0, 2}, }; -static arc arcs_77_3[1] = { +static arc arcs_73_3[1] = { {22, 2}, }; -static state states_77[4] = { - {1, arcs_77_0}, - {3, arcs_77_1}, - {1, arcs_77_2}, - {1, arcs_77_3}, +static state states_73[4] = { + {1, arcs_73_0}, + {3, arcs_73_1}, + {1, arcs_73_2}, + {1, arcs_73_3}, }; -static arc arcs_78_0[2] = { - {156, 1}, - {163, 1}, +static arc arcs_74_0[2] = { + {152, 1}, + {159, 1}, }; -static arc arcs_78_1[1] = { +static arc arcs_74_1[1] = { {0, 1}, }; -static state states_78[2] = { - {2, arcs_78_0}, - {1, arcs_78_1}, +static state states_74[2] = { + {2, arcs_74_0}, + {1, arcs_74_1}, }; -static arc arcs_79_0[1] = { - {97, 1}, +static arc arcs_75_0[1] = { + {93, 1}, }; -static arc arcs_79_1[1] = { - {62, 2}, +static arc arcs_75_1[1] = { + {58, 2}, }; -static arc arcs_79_2[1] = { - {98, 3}, +static arc arcs_75_2[1] = { + {94, 3}, }; -static arc arcs_79_3[1] = { - {108, 4}, +static arc arcs_75_3[1] = { + {104, 4}, }; -static arc arcs_79_4[2] = { - {162, 5}, +static arc arcs_75_4[2] = { + {158, 5}, {0, 4}, }; -static arc arcs_79_5[1] = { +static arc arcs_75_5[1] = { {0, 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 state states_75[6] = { + {1, arcs_75_0}, + {1, arcs_75_1}, + {1, arcs_75_2}, + {1, arcs_75_3}, + {2, arcs_75_4}, + {1, arcs_75_5}, }; -static arc arcs_80_0[1] = { - {93, 1}, +static arc arcs_76_0[1] = { + {89, 1}, }; -static arc arcs_80_1[1] = { - {110, 2}, +static arc arcs_76_1[1] = { + {106, 2}, }; -static arc arcs_80_2[2] = { - {162, 3}, +static arc arcs_76_2[2] = { + {158, 3}, {0, 2}, }; -static arc arcs_80_3[1] = { +static arc arcs_76_3[1] = { {0, 3}, }; -static state states_80[4] = { - {1, arcs_80_0}, - {1, arcs_80_1}, - {2, arcs_80_2}, - {1, arcs_80_3}, +static state states_76[4] = { + {1, arcs_76_0}, + {1, arcs_76_1}, + {2, arcs_76_2}, + {1, arcs_76_3}, }; -static arc arcs_81_0[1] = { +static arc arcs_77_0[1] = { {22, 1}, }; -static arc arcs_81_1[2] = { +static arc arcs_77_1[2] = { {28, 0}, {0, 1}, }; -static state states_81[2] = { - {1, arcs_81_0}, - {2, arcs_81_1}, +static state states_77[2] = { + {1, arcs_77_0}, + {2, arcs_77_1}, }; -static arc arcs_82_0[1] = { +static arc arcs_78_0[1] = { {19, 1}, }; -static arc arcs_82_1[1] = { +static arc arcs_78_1[1] = { {0, 1}, }; -static state states_82[2] = { - {1, arcs_82_0}, - {1, arcs_82_1}, +static state states_78[2] = { + {1, arcs_78_0}, + {1, arcs_78_1}, }; -static arc arcs_83_0[1] = { - {166, 1}, +static arc arcs_79_0[1] = { + {162, 1}, }; -static arc arcs_83_1[2] = { +static arc arcs_79_1[2] = { {9, 2}, {0, 1}, }; -static arc arcs_83_2[1] = { +static arc arcs_79_2[1] = { {0, 2}, }; -static state states_83[3] = { - {1, arcs_83_0}, - {2, arcs_83_1}, - {1, arcs_83_2}, +static state states_79[3] = { + {1, arcs_79_0}, + {2, arcs_79_1}, + {1, arcs_79_2}, }; -static dfa dfas[84] = { +static dfa dfas[80] = { {256, "single_input", 0, 3, states_0, - "\004\050\014\040\000\000\000\240\340\251\160\040\113\000\041\000\000\014\241\014\101"}, + "\004\050\014\040\000\000\000\012\236\012\007\262\004\020\002\000\300\020\312\020\004"}, {257, "file_input", 0, 2, states_1, - "\204\050\014\040\000\000\000\240\340\251\160\040\113\000\041\000\000\014\241\014\101"}, + "\204\050\014\040\000\000\000\012\236\012\007\262\004\020\002\000\300\020\312\020\004"}, {258, "eval_input", 0, 3, states_2, - "\000\040\010\040\000\000\000\000\000\200\000\000\000\000\041\000\000\014\241\014\000"}, + "\000\040\010\040\000\000\000\000\000\010\000\000\000\020\002\000\300\020\312\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"}, {260, "decorators", 0, 2, states_4, @@ -1793,176 +1723,168 @@ {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"}, {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"}, - {264, "tname", 0, 4, states_8, + "\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, "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"}, - {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"}, - {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"}, - {268, "vname", 0, 2, states_12, + {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"}, - {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"}, - {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"}, - {271, "stmt", 0, 2, states_15, - "\000\050\014\040\000\000\000\240\340\251\160\040\113\000\041\000\000\014\241\014\101"}, - {272, "simple_stmt", 0, 4, states_16, - "\000\040\010\040\000\000\000\240\340\251\160\000\000\000\041\000\000\014\241\014\100"}, - {273, "small_stmt", 0, 2, states_17, - "\000\040\010\040\000\000\000\240\340\251\160\000\000\000\041\000\000\014\241\014\100"}, - {274, "expr_stmt", 0, 6, states_18, - "\000\040\010\040\000\000\000\000\000\200\000\000\000\000\041\000\000\014\241\014\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"}, - {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"}, - {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"}, - {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\100"}, - {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"}, - {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"}, - {281, "return_stmt", 0, 3, states_25, + {267, "stmt", 0, 2, states_11, + "\000\050\014\040\000\000\000\012\236\012\007\262\004\020\002\000\300\020\312\020\004"}, + {268, "simple_stmt", 0, 4, states_12, + "\000\040\010\040\000\000\000\012\236\012\007\000\000\020\002\000\300\020\312\000\004"}, + {269, "small_stmt", 0, 2, states_13, + "\000\040\010\040\000\000\000\012\236\012\007\000\000\020\002\000\300\020\312\000\004"}, + {270, "expr_stmt", 0, 6, states_14, + "\000\040\010\040\000\000\000\000\000\010\000\000\000\020\002\000\300\020\312\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\004"}, + {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\004"}, + {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, "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\100"}, - {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"}, - {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"}, - {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"}, - {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"}, - {287, "import_as_name", 0, 4, states_31, + {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"}, - {288, "dotted_as_name", 0, 4, states_32, + {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"}, - {289, "import_as_names", 0, 3, states_33, + {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"}, - {290, "dotted_as_names", 0, 2, states_34, + {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"}, - {291, "dotted_name", 0, 2, states_35, + {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"}, - {292, "global_stmt", 0, 3, states_36, - "\000\000\000\000\000\000\000\000\000\000\020\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\040\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\100\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\040\113\000\000\000\000\000\000\000\001"}, - {296, "if_stmt", 0, 8, states_40, - "\000\000\000\000\000\000\000\000\000\000\000\040\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\000\001\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\002\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\010\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\100\000\000\000\000\000\000\000\000"}, - {301, "with_var", 0, 3, states_45, + {288, "global_stmt", 0, 3, states_32, + "\000\000\000\000\000\000\000\000\000\000\001\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\002\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\004\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\002\000\000\000\000\000\000\000"}, - {303, "suite", 0, 5, states_47, - "\004\040\010\040\000\000\000\240\340\251\160\000\000\000\041\000\000\014\241\014\100"}, - {304, "test", 0, 6, states_48, - "\000\040\010\040\000\000\000\000\000\200\000\000\000\000\041\000\000\014\241\014\000"}, - {305, "test_nocond", 0, 2, states_49, - "\000\040\010\040\000\000\000\000\000\200\000\000\000\000\041\000\000\014\241\014\000"}, - {306, "lambdef", 0, 5, states_50, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000"}, - {307, "lambdef_nocond", 0, 5, states_51, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000"}, - {308, "or_test", 0, 2, states_52, - "\000\040\010\040\000\000\000\000\000\200\000\000\000\000\040\000\000\014\241\014\000"}, - {309, "and_test", 0, 2, states_53, - "\000\040\010\040\000\000\000\000\000\200\000\000\000\000\040\000\000\014\241\014\000"}, - {310, "not_test", 0, 3, states_54, - "\000\040\010\040\000\000\000\000\000\200\000\000\000\000\040\000\000\014\241\014\000"}, - {311, "comparison", 0, 2, states_55, - "\000\040\010\040\000\000\000\000\000\200\000\000\000\000\000\000\000\014\241\014\000"}, - {312, "comp_op", 0, 4, states_56, - "\000\000\000\000\000\000\000\000\000\000\000\000\004\000\040\376\000\000\000\000\000"}, - {313, "star_expr", 0, 3, states_57, - "\000\040\010\040\000\000\000\000\000\200\000\000\000\000\000\000\000\014\241\014\000"}, - {314, "expr", 0, 2, states_58, - "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\000\000\000\014\241\014\000"}, - {315, "xor_expr", 0, 2, states_59, - "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\000\000\000\014\241\014\000"}, - {316, "and_expr", 0, 2, states_60, - "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\000\000\000\014\241\014\000"}, - {317, "shift_expr", 0, 2, states_61, - "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\000\000\000\014\241\014\000"}, - {318, "arith_expr", 0, 2, states_62, - "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\000\000\000\014\241\014\000"}, - {319, "term", 0, 2, states_63, - "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\000\000\000\014\241\014\000"}, - {320, "factor", 0, 3, states_64, - "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\000\000\000\014\241\014\000"}, - {321, "power", 0, 4, states_65, - "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\240\014\000"}, - {322, "atom", 0, 9, states_66, - "\000\040\010\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\240\014\000"}, - {323, "testlist_comp", 0, 5, states_67, - "\000\040\010\040\000\000\000\000\000\200\000\000\000\000\041\000\000\014\241\014\000"}, - {324, "trailer", 0, 7, states_68, - "\000\040\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\040\000\000"}, - {325, "subscriptlist", 0, 3, states_69, - "\000\040\210\040\000\000\000\000\000\200\000\000\000\000\041\000\000\014\241\014\000"}, - {326, "subscript", 0, 5, states_70, - "\000\040\210\040\000\000\000\000\000\200\000\000\000\000\041\000\000\014\241\014\000"}, - {327, "sliceop", 0, 3, states_71, + {291, "compound_stmt", 0, 2, states_35, + "\000\010\004\000\000\000\000\000\000\000\000\262\004\000\000\000\000\000\000\020\000"}, + {292, "if_stmt", 0, 8, states_36, + "\000\000\000\000\000\000\000\000\000\000\000\002\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\020\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\040\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\200\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\004\000\000\000\000\000\000\000\000"}, + {297, "with_var", 0, 3, states_41, + "\000\000\000\000\000\000\000\000\000\100\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\040\000\000\000\000\000\000\000\000"}, + {299, "suite", 0, 5, states_43, + "\004\040\010\040\000\000\000\012\236\012\007\000\000\020\002\000\300\020\312\000\004"}, + {300, "test", 0, 6, states_44, + "\000\040\010\040\000\000\000\000\000\010\000\000\000\020\002\000\300\020\312\000\000"}, + {301, "test_nocond", 0, 2, states_45, + "\000\040\010\040\000\000\000\000\000\010\000\000\000\020\002\000\300\020\312\000\000"}, + {302, "lambdef", 0, 5, states_46, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000"}, + {303, "lambdef_nocond", 0, 5, states_47, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000"}, + {304, "or_test", 0, 2, states_48, + "\000\040\010\040\000\000\000\000\000\010\000\000\000\000\002\000\300\020\312\000\000"}, + {305, "and_test", 0, 2, states_49, + "\000\040\010\040\000\000\000\000\000\010\000\000\000\000\002\000\300\020\312\000\000"}, + {306, "not_test", 0, 3, states_50, + "\000\040\010\040\000\000\000\000\000\010\000\000\000\000\002\000\300\020\312\000\000"}, + {307, "comparison", 0, 2, states_51, + "\000\040\010\040\000\000\000\000\000\010\000\000\000\000\000\000\300\020\312\000\000"}, + {308, "comp_op", 0, 4, states_52, + "\000\000\000\000\000\000\000\000\000\000\000\100\000\000\342\017\000\000\000\000\000"}, + {309, "star_expr", 0, 3, states_53, + "\000\040\010\040\000\000\000\000\000\010\000\000\000\000\000\000\300\020\312\000\000"}, + {310, "expr", 0, 2, states_54, + "\000\040\010\000\000\000\000\000\000\010\000\000\000\000\000\000\300\020\312\000\000"}, + {311, "xor_expr", 0, 2, states_55, + "\000\040\010\000\000\000\000\000\000\010\000\000\000\000\000\000\300\020\312\000\000"}, + {312, "and_expr", 0, 2, states_56, + "\000\040\010\000\000\000\000\000\000\010\000\000\000\000\000\000\300\020\312\000\000"}, + {313, "shift_expr", 0, 2, states_57, + "\000\040\010\000\000\000\000\000\000\010\000\000\000\000\000\000\300\020\312\000\000"}, + {314, "arith_expr", 0, 2, states_58, + "\000\040\010\000\000\000\000\000\000\010\000\000\000\000\000\000\300\020\312\000\000"}, + {315, "term", 0, 2, states_59, + "\000\040\010\000\000\000\000\000\000\010\000\000\000\000\000\000\300\020\312\000\000"}, + {316, "factor", 0, 3, states_60, + "\000\040\010\000\000\000\000\000\000\010\000\000\000\000\000\000\300\020\312\000\000"}, + {317, "power", 0, 4, states_61, + "\000\040\010\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\312\000\000"}, + {318, "atom", 0, 9, states_62, + "\000\040\010\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\312\000\000"}, + {319, "testlist_comp", 0, 5, states_63, + "\000\040\010\040\000\000\000\000\000\010\000\000\000\020\002\000\300\020\312\000\000"}, + {320, "trailer", 0, 7, states_64, + "\000\040\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000\002\000\000"}, + {321, "subscriptlist", 0, 3, states_65, + "\000\040\210\040\000\000\000\000\000\010\000\000\000\020\002\000\300\020\312\000\000"}, + {322, "subscript", 0, 5, states_66, + "\000\040\210\040\000\000\000\000\000\010\000\000\000\020\002\000\300\020\312\000\000"}, + {323, "sliceop", 0, 3, states_67, "\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {328, "exprlist", 0, 3, states_72, - "\000\040\010\040\000\000\000\000\000\200\000\000\000\000\000\000\000\014\241\014\000"}, - {329, "testlist", 0, 3, states_73, - "\000\040\010\040\000\000\000\000\000\200\000\000\000\000\041\000\000\014\241\014\000"}, - {330, "dictorsetmaker", 0, 9, states_74, - "\000\040\010\040\000\000\000\000\000\200\000\000\000\000\041\000\000\014\241\014\000"}, - {331, "classdef", 0, 8, states_75, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\001"}, - {332, "arglist", 0, 8, states_76, - "\000\040\010\240\000\000\000\000\000\200\000\000\000\000\041\000\000\014\241\014\000"}, - {333, "argument", 0, 4, states_77, - "\000\040\010\040\000\000\000\000\000\200\000\000\000\000\041\000\000\014\241\014\000"}, - {334, "comp_iter", 0, 2, states_78, - "\000\000\000\000\000\000\000\000\000\000\000\040\002\000\000\000\000\000\000\000\000"}, - {335, "comp_for", 0, 6, states_79, - "\000\000\000\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000"}, - {336, "comp_if", 0, 4, states_80, + {324, "exprlist", 0, 3, states_68, + "\000\040\010\040\000\000\000\000\000\010\000\000\000\000\000\000\300\020\312\000\000"}, + {325, "testlist", 0, 3, states_69, + "\000\040\010\040\000\000\000\000\000\010\000\000\000\020\002\000\300\020\312\000\000"}, + {326, "dictorsetmaker", 0, 9, states_70, + "\000\040\010\040\000\000\000\000\000\010\000\000\000\020\002\000\300\020\312\000\000"}, + {327, "classdef", 0, 8, states_71, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\020\000"}, + {328, "arglist", 0, 8, states_72, + "\000\040\010\140\000\000\000\000\000\010\000\000\000\020\002\000\300\020\312\000\000"}, + {329, "argument", 0, 4, states_73, + "\000\040\010\040\000\000\000\000\000\010\000\000\000\020\002\000\300\020\312\000\000"}, + {330, "comp_iter", 0, 2, states_74, + "\000\000\000\000\000\000\000\000\000\000\000\042\000\000\000\000\000\000\000\000\000"}, + {331, "comp_for", 0, 6, states_75, "\000\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000"}, - {337, "testlist1", 0, 2, states_81, - "\000\040\010\040\000\000\000\000\000\200\000\000\000\000\041\000\000\014\241\014\000"}, - {338, "encoding_decl", 0, 2, states_82, + {332, "comp_if", 0, 4, states_76, + "\000\000\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000"}, + {333, "testlist1", 0, 2, states_77, + "\000\040\010\040\000\000\000\000\000\010\000\000\000\020\002\000\300\020\312\000\000"}, + {334, "encoding_decl", 0, 2, states_78, "\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\100"}, + {335, "yield_expr", 0, 3, states_79, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\004"}, }; -static label labels[167] = { +static label labels[163] = { {0, "EMPTY"}, {256, 0}, {4, 0}, - {272, 0}, - {295, 0}, + {268, 0}, + {291, 0}, {257, 0}, - {271, 0}, + {267, 0}, {0, 0}, {258, 0}, - {329, 0}, + {325, 0}, {259, 0}, {50, 0}, - {291, 0}, + {287, 0}, {7, 0}, - {332, 0}, + {328, 0}, {8, 0}, {260, 0}, {261, 0}, @@ -1970,33 +1892,29 @@ {1, 0}, {262, 0}, {51, 0}, - {304, 0}, + {300, 0}, {11, 0}, - {303, 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}, - {339, 0}, + {280, 0}, + {288, 0}, + {289, 0}, + {290, 0}, + {271, 0}, + {335, 0}, {37, 0}, {38, 0}, {39, 0}, @@ -2010,37 +1928,37 @@ {47, 0}, {49, 0}, {1, "del"}, - {328, 0}, + {324, 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}, {52, 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}, - {331, 0}, + {327, 0}, {1, "if"}, {1, "elif"}, {1, "else"}, @@ -2048,27 +1966,27 @@ {1, "for"}, {1, "in"}, {1, "try"}, - {302, 0}, + {298, 0}, {1, "finally"}, {1, "with"}, - {301, 0}, - {314, 0}, + {297, 0}, + {310, 0}, {1, "except"}, {5, 0}, {6, 0}, - {308, 0}, - {306, 0}, - {305, 0}, - {307, 0}, + {304, 0}, + {302, 0}, + {301, 0}, + {303, 0}, {1, "lambda"}, - {309, 0}, + {305, 0}, {1, "or"}, - {310, 0}, + {306, 0}, {1, "and"}, {1, "not"}, - {311, 0}, - {313, 0}, - {312, 0}, + {307, 0}, + {309, 0}, + {308, 0}, {20, 0}, {21, 0}, {28, 0}, @@ -2076,49 +1994,49 @@ {30, 0}, {29, 0}, {1, "is"}, - {315, 0}, + {311, 0}, {18, 0}, - {316, 0}, + {312, 0}, {33, 0}, - {317, 0}, + {313, 0}, {19, 0}, - {318, 0}, + {314, 0}, {34, 0}, {35, 0}, - {319, 0}, + {315, 0}, {14, 0}, {15, 0}, - {320, 0}, + {316, 0}, {17, 0}, {24, 0}, {48, 0}, {32, 0}, - {321, 0}, - {322, 0}, - {324, 0}, - {323, 0}, + {317, 0}, + {318, 0}, + {320, 0}, + {319, 0}, {9, 0}, {10, 0}, {26, 0}, - {330, 0}, + {326, 0}, {27, 0}, {2, 0}, {3, 0}, - {335, 0}, - {325, 0}, - {326, 0}, - {327, 0}, + {331, 0}, + {321, 0}, + {322, 0}, + {323, 0}, {1, "class"}, + {329, 0}, + {330, 0}, + {332, 0}, {333, 0}, {334, 0}, - {336, 0}, - {337, 0}, - {338, 0}, {1, "yield"}, }; grammar _PyParser_Grammar = { - 84, + 80, dfas, - {167, labels}, + {163, labels}, 256 }; Index: Python/ast.c =================================================================== --- Python/ast.c (revision 55289) +++ Python/ast.c (working copy) @@ -562,13 +562,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"); @@ -584,51 +584,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 */ @@ -646,8 +607,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) { @@ -676,7 +637,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; @@ -706,13 +667,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; @@ -734,17 +697,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++; } @@ -753,9 +712,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; @@ -780,12 +738,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 */ @@ -812,14 +766,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); @@ -831,7 +778,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 */ @@ -847,12 +794,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); @@ -862,8 +809,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 55289) +++ Python/symtable.c (working copy) @@ -180,10 +180,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); @@ -1328,79 +1326,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); @@ -1413,9 +1383,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)) @@ -1427,8 +1397,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 55289) +++ Python/compile.c (working copy) @@ -1283,54 +1283,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) { @@ -1339,7 +1291,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; } @@ -1368,17 +1320,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; } @@ -1498,9 +1444,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); @@ -1690,9 +1633,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 55289) +++ Python/Python-ast.c (working copy) @@ -367,15 +367,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[]={ @@ -752,14 +747,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); @@ -1865,35 +1854,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) { @@ -3048,31 +3024,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); @@ -3295,10 +3258,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 55289) +++ Include/graminit.h (working copy) @@ -6,79 +6,75 @@ #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 test 304 -#define test_nocond 305 -#define lambdef 306 -#define lambdef_nocond 307 -#define or_test 308 -#define and_test 309 -#define not_test 310 -#define comparison 311 -#define comp_op 312 -#define star_expr 313 -#define expr 314 -#define xor_expr 315 -#define and_expr 316 -#define shift_expr 317 -#define arith_expr 318 -#define term 319 -#define factor 320 -#define power 321 -#define atom 322 -#define testlist_comp 323 -#define trailer 324 -#define subscriptlist 325 -#define subscript 326 -#define sliceop 327 -#define exprlist 328 -#define testlist 329 -#define dictorsetmaker 330 -#define classdef 331 -#define arglist 332 -#define argument 333 -#define comp_iter 334 -#define comp_for 335 -#define comp_if 336 -#define testlist1 337 -#define encoding_decl 338 -#define yield_expr 339 +#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 test 300 +#define test_nocond 301 +#define lambdef 302 +#define lambdef_nocond 303 +#define or_test 304 +#define and_test 305 +#define not_test 306 +#define comparison 307 +#define comp_op 308 +#define star_expr 309 +#define expr 310 +#define xor_expr 311 +#define and_expr 312 +#define shift_expr 313 +#define arith_expr 314 +#define term 315 +#define factor 316 +#define power 317 +#define atom 318 +#define testlist_comp 319 +#define trailer 320 +#define subscriptlist 321 +#define subscript 322 +#define sliceop 323 +#define exprlist 324 +#define testlist 325 +#define dictorsetmaker 326 +#define classdef 327 +#define arglist 328 +#define argument 329 +#define comp_iter 330 +#define comp_for 331 +#define comp_if 332 +#define testlist1 333 +#define encoding_decl 334 +#define yield_expr 335 Index: Include/Python-ast.h =================================================================== --- Include/Python-ast.h (revision 55289) +++ Include/Python-ast.h (working copy) @@ -355,20 +355,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 { @@ -535,10 +524,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 55289) +++ 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 55289) +++ Parser/Python.asdl (working copy) @@ -110,8 +110,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 55289) +++ 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: Doc/lib/libitertools.tex =================================================================== --- Doc/lib/libitertools.tex (revision 55289) +++ 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 55289) +++ Doc/ref/ref5.tex (working copy) @@ -668,11 +668,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 @@ -1177,7 +1173,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 55289) +++ 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 55289) +++ 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: Lib/wave.py =================================================================== --- Lib/wave.py (revision 55289) +++ Lib/wave.py (working copy) @@ -384,7 +384,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/idlelib/Debugger.py =================================================================== --- Lib/idlelib/Debugger.py (revision 55289) +++ 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 55289) +++ 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 55289) +++ 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 55289) +++ Lib/tokenize.py (working copy) @@ -131,7 +131,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 55289) +++ 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 55289) +++ 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-irix6/flp.py =================================================================== --- Lib/plat-irix6/flp.py (revision 55289) +++ 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 55289) +++ 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, file_info): + suffix, mode, type = file_info 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 55289) +++ 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 55289) +++ 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: @@ -967,7 +963,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)) @@ -1365,8 +1361,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) @@ -1383,8 +1379,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 @@ -1395,13 +1389,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)) @@ -1487,24 +1474,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): @@ -1513,12 +1482,13 @@ yield tuple(_nested_names(arg)) def generateKwonlyArgList(keywordOnlyArgs): + # XXX Not used internally; OK to get rid of since not documented? 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 55289) +++ Lib/compiler/transformer.py (working copy) @@ -333,24 +333,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 @@ -648,9 +636,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 @@ -660,9 +648,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 @@ -673,13 +661,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] @@ -704,7 +692,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) @@ -789,10 +777,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): @@ -806,33 +794,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 = [] @@ -844,15 +823,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 @@ -863,12 +842,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 @@ -886,23 +865,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 55289) +++ Lib/compiler/ast.py (working copy) @@ -54,7 +54,7 @@ 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 @@ -311,12 +332,9 @@ return "CallFunc(%s, %s, %s, %s)" % (repr(self.node), repr(self.args), repr(self.star_args), repr(self.dstar_args)) class Class(Node): - def __init__(self, name, args, star_args, dstar_args, - doc, code, lineno=None): + def __init__(self, name, bases, doc, code, lineno=None): self.name = name - self.args = args - self.star_args = star_args - self.dstar_args = dstar_args + self.bases = bases self.doc = doc self.code = code self.lineno = lineno @@ -324,30 +342,19 @@ def getChildren(self): children = [] children.append(self.name) - children.extend(flatten(self.args)) - children.extend(self.star_args) - children.extend(self.dstar_args) + children.extend(flatten(self.bases)) children.append(self.doc) children.append(self.code) return tuple(children) def getChildNodes(self): nodelist = [] - nodelist.extend(flatten_nodes(self.args)) - if self.star_args is not None: - nodelist.append(self.star_args) - if self.dstar_args is not None: - nodelist.append(self.dstar_args) + nodelist.extend(flatten_nodes(self.bases)) nodelist.append(self.code) return tuple(nodelist) def __repr__(self): - return "Class(%r, %r, %r, %r, %r, %r)" % (self.name, - self.args, - self.star_args, - self.dstar_args, - self.doc, - self.code) + return "Class(%s, %s, %s, %s)" % (repr(self.name), repr(self.bases), repr(self.doc), repr(self.code)) class Compare(Node): def __init__(self, expr, ops, lineno=None): @@ -444,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 @@ -456,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 @@ -471,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): @@ -568,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 = () @@ -804,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 @@ -816,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): @@ -894,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 @@ -906,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): @@ -924,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 @@ -936,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): @@ -952,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 @@ -1012,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 @@ -1024,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): @@ -1068,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 @@ -1080,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): @@ -1098,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 @@ -1180,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 @@ -1192,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 55289) +++ 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 55289) +++ Lib/pdb.py (working copy) @@ -180,13 +180,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.""" + exc_type, exc_value, exc_traceback = exc_info 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_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 55289) +++ Lib/pydoc.py (working copy) @@ -171,11 +171,12 @@ def classify_class_attrs(object): """Wrap inspect.classify_class_attrs, with fixup for data descriptors.""" - def fixup((name, kind, cls, value)): + results = [] + 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)) + results.append((name, kind, cls, value)) + return results # ----------------------------------------------------- module manipulation @@ -228,11 +229,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 @@ -502,8 +501,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: @@ -662,12 +662,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: @@ -768,8 +768,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 +1073,7 @@ 'PACKAGE CONTENTS', '\n'.join(modpkgs)) 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 +1177,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 55289) +++ 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 55289) +++ 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 55289) +++ 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 55289) +++ 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 55289) +++ 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 55289) +++ 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 55289) +++ Lib/test/test_itertools.py (working copy) @@ -857,7 +857,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 55289) +++ 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 55289) +++ 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 @@ -394,16 +374,16 @@ 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 + # 16 bits are available for # of annotations, but only 8 bits are + # available for the parameter count, hence 255 # 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 range(65535)) + s = "def f(%s): pass" + s %= ', '.join('a%d:%d' % (i,i) for i in range(256)) 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 range(65534)) + s = "def f(%s): pass" + s %= ', '.join('a%d:%d' % (i,i) for i in range(255)) compile(s, '?', 'exec') def test_mangling(self): Index: Lib/test/test_sort.py =================================================================== --- Lib/test/test_sort.py (revision 55289) +++ Lib/test/test_sort.py (working copy) @@ -184,7 +184,7 @@ def test_stability(self): data = [(random.randrange(100), i) for i in range(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 55289) +++ Lib/test/test_compiler.py (working copy) @@ -129,15 +129,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 +140,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 55289) +++ 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 55289) +++ 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 55289) +++ 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 55289) +++ Lib/test/test_grammar.py (working copy) @@ -144,51 +144,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,) @@ -203,17 +184,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) @@ -286,10 +257,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) @@ -312,12 +279,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 55289) +++ 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 @@ -184,10 +185,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 55289) +++ 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 55289) +++ 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 55289) +++ 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 55289) +++ 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 55289) +++ 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); @@ -862,7 +862,7 @@ VALIDATER(import_stmt); VALIDATER(import_stmt); VALIDATER(import_name); VALIDATER(yield_stmt); VALIDATER(global_stmt); VALIDATER(assert_stmt); -VALIDATER(compound_stmt); VALIDATER(vname); +VALIDATER(compound_stmt); VALIDATER(while); VALIDATER(for); VALIDATER(try); VALIDATER(except_clause); VALIDATER(test); VALIDATER(and_test); @@ -1111,18 +1111,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); } @@ -1135,8 +1135,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) @@ -1152,27 +1152,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)); @@ -1182,9 +1182,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)); } } } @@ -1193,7 +1193,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"); @@ -1206,19 +1206,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 @@ -1229,92 +1225,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; @@ -1379,48 +1321,6 @@ } -/* 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 * */