diff options
author | Brett Cannon <bcannon@gmail.com> | 2006-08-25 04:28:18 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2006-08-25 04:28:18 (GMT) |
commit | cf588f6448f8adfa12886f42db4d1c4ad3544da5 (patch) | |
tree | 47cb062874fff18940e7efee1d9001920753fbad /Python | |
parent | 8b6de130c64ace2a5bd56ec619eb54216676b613 (diff) | |
download | cpython-cf588f6448f8adfa12886f42db4d1c4ad3544da5.zip cpython-cf588f6448f8adfa12886f42db4d1c4ad3544da5.tar.gz cpython-cf588f6448f8adfa12886f42db4d1c4ad3544da5.tar.bz2 |
Remove support for backticks from the grammar and compiler.
Still need to remove traces of the UNARY_CONVERT opcode.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ast.c | 9 | ||||
-rw-r--r-- | Python/compile.c | 5 | ||||
-rw-r--r-- | Python/graminit.c | 178 |
3 files changed, 85 insertions, 107 deletions
diff --git a/Python/ast.c b/Python/ast.c index f472d96..b566ba3 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -1190,7 +1190,7 @@ static expr_ty ast_for_atom(struct compiling *c, const node *n) { /* atom: '(' [yield_expr|testlist_gexp] ')' | '[' [listmaker] ']' - | '{' [dictmaker] '}' | '`' testlist '`' | NAME | NUMBER | STRING+ + | '{' [dictmaker] '}' | NAME | NUMBER | STRING+ */ node *ch = CHILD(n, 0); @@ -1276,13 +1276,6 @@ ast_for_atom(struct compiling *c, const node *n) } return Dict(keys, values, LINENO(n), n->n_col_offset, c->c_arena); } - case BACKQUOTE: { /* repr */ - expr_ty expression = ast_for_testlist(c, CHILD(n, 1)); - if (!expression) - return NULL; - - return Repr(expression, LINENO(n), n->n_col_offset, c->c_arena); - } default: PyErr_Format(PyExc_SystemError, "unhandled atom %d", TYPE(ch)); return NULL; diff --git a/Python/compile.c b/Python/compile.c index 464c953..4601f2c 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -721,7 +721,6 @@ opcode_stack_effect(int opcode, int oparg) case UNARY_POSITIVE: case UNARY_NEGATIVE: case UNARY_NOT: - case UNARY_CONVERT: case UNARY_INVERT: return 0; @@ -2983,10 +2982,6 @@ compiler_visit_expr(struct compiler *c, expr_ty e) return compiler_compare(c, e); case Call_kind: return compiler_call(c, e); - case Repr_kind: - VISIT(c, expr, e->v.Repr.value); - ADDOP(c, UNARY_CONVERT); - break; case Num_kind: ADDOP_O(c, LOAD_CONST, e->v.Num.n, consts); break; diff --git a/Python/graminit.c b/Python/graminit.c index 8299563..cfbd7a4 100644 --- a/Python/graminit.c +++ b/Python/graminit.c @@ -1242,68 +1242,59 @@ static state states_60[4] = { {1, arcs_60_2}, {1, arcs_60_3}, }; -static arc arcs_61_0[7] = { +static arc arcs_61_0[6] = { {13, 1}, {144, 2}, {147, 3}, + {19, 4}, {150, 4}, - {19, 5}, - {152, 5}, - {153, 6}, + {151, 5}, }; static arc arcs_61_1[3] = { - {43, 7}, - {143, 7}, - {15, 5}, + {43, 6}, + {143, 6}, + {15, 4}, }; static arc arcs_61_2[2] = { - {145, 8}, - {146, 5}, + {145, 7}, + {146, 4}, }; static arc arcs_61_3[2] = { - {148, 9}, - {149, 5}, + {148, 8}, + {149, 4}, }; static arc arcs_61_4[1] = { - {151, 10}, + {0, 4}, }; -static arc arcs_61_5[1] = { +static arc arcs_61_5[2] = { + {151, 5}, {0, 5}, }; -static arc arcs_61_6[2] = { - {153, 6}, - {0, 6}, +static arc arcs_61_6[1] = { + {15, 4}, }; static arc arcs_61_7[1] = { - {15, 5}, + {146, 4}, }; static arc arcs_61_8[1] = { - {146, 5}, -}; -static arc arcs_61_9[1] = { - {149, 5}, + {149, 4}, }; -static arc arcs_61_10[1] = { - {150, 5}, -}; -static state states_61[11] = { - {7, arcs_61_0}, +static state states_61[9] = { + {6, arcs_61_0}, {3, arcs_61_1}, {2, arcs_61_2}, {2, arcs_61_3}, {1, arcs_61_4}, - {1, arcs_61_5}, - {2, arcs_61_6}, + {2, arcs_61_5}, + {1, arcs_61_6}, {1, arcs_61_7}, {1, arcs_61_8}, - {1, arcs_61_9}, - {1, arcs_61_10}, }; static arc arcs_62_0[1] = { {26, 1}, }; static arc arcs_62_1[3] = { - {154, 2}, + {152, 2}, {27, 3}, {0, 1}, }; @@ -1329,7 +1320,7 @@ static arc arcs_63_0[1] = { {26, 1}, }; static arc arcs_63_1[3] = { - {155, 2}, + {153, 2}, {27, 3}, {0, 1}, }; @@ -1384,7 +1375,7 @@ static arc arcs_65_1[2] = { {15, 5}, }; static arc arcs_65_2[1] = { - {156, 6}, + {154, 6}, }; static arc arcs_65_3[1] = { {19, 5}, @@ -1408,14 +1399,14 @@ static state states_65[7] = { {1, arcs_65_6}, }; static arc arcs_66_0[1] = { - {157, 1}, + {155, 1}, }; static arc arcs_66_1[2] = { {27, 2}, {0, 1}, }; static arc arcs_66_2[2] = { - {157, 1}, + {155, 1}, {0, 2}, }; static state states_66[3] = { @@ -1437,14 +1428,14 @@ static arc arcs_67_2[2] = { }; static arc arcs_67_3[3] = { {26, 5}, - {158, 6}, + {156, 6}, {0, 3}, }; static arc arcs_67_4[1] = { {75, 6}, }; static arc arcs_67_5[2] = { - {158, 6}, + {156, 6}, {0, 5}, }; static arc arcs_67_6[1] = { @@ -1531,7 +1522,7 @@ static state states_71[5] = { {2, arcs_71_4}, }; static arc arcs_72_0[1] = { - {159, 1}, + {157, 1}, }; static arc arcs_72_1[1] = { {19, 2}, @@ -1567,7 +1558,7 @@ static state states_72[8] = { {1, arcs_72_7}, }; static arc arcs_73_0[3] = { - {160, 1}, + {158, 1}, {28, 2}, {29, 3}, }; @@ -1582,7 +1573,7 @@ static arc arcs_73_3[1] = { {26, 6}, }; static arc arcs_73_4[4] = { - {160, 1}, + {158, 1}, {28, 2}, {29, 3}, {0, 4}, @@ -1611,7 +1602,7 @@ static arc arcs_74_0[1] = { {26, 1}, }; static arc arcs_74_1[3] = { - {155, 2}, + {153, 2}, {25, 3}, {0, 1}, }; @@ -1628,8 +1619,8 @@ static state states_74[4] = { {1, arcs_74_3}, }; static arc arcs_75_0[2] = { - {154, 1}, - {162, 1}, + {152, 1}, + {160, 1}, }; static arc arcs_75_1[1] = { {0, 1}, @@ -1651,7 +1642,7 @@ static arc arcs_76_3[1] = { {104, 4}, }; static arc arcs_76_4[2] = { - {161, 5}, + {159, 5}, {0, 4}, }; static arc arcs_76_5[1] = { @@ -1672,7 +1663,7 @@ static arc arcs_77_1[1] = { {105, 2}, }; static arc arcs_77_2[2] = { - {161, 3}, + {159, 3}, {0, 2}, }; static arc arcs_77_3[1] = { @@ -1685,8 +1676,8 @@ static state states_77[4] = { {1, arcs_77_3}, }; static arc arcs_78_0[2] = { - {155, 1}, - {164, 1}, + {153, 1}, + {162, 1}, }; static arc arcs_78_1[1] = { {0, 1}, @@ -1708,7 +1699,7 @@ static arc arcs_79_3[1] = { {106, 4}, }; static arc arcs_79_4[2] = { - {163, 5}, + {161, 5}, {0, 4}, }; static arc arcs_79_5[1] = { @@ -1729,7 +1720,7 @@ static arc arcs_80_1[1] = { {105, 2}, }; static arc arcs_80_2[2] = { - {163, 3}, + {161, 3}, {0, 2}, }; static arc arcs_80_3[1] = { @@ -1763,7 +1754,7 @@ static state states_82[2] = { {1, arcs_82_1}, }; static arc arcs_83_0[1] = { - {166, 1}, + {165, 1}, }; static arc arcs_83_1[2] = { {9, 2}, @@ -1779,11 +1770,11 @@ static state states_83[3] = { }; static dfa dfas[84] = { {256, "single_input", 0, 3, states_0, - "\004\050\014\000\000\000\000\025\074\005\023\310\011\020\004\000\140\010\111\203\100"}, + "\004\050\014\000\000\000\000\025\074\005\023\310\011\020\004\000\140\010\311\040\040"}, {257, "file_input", 0, 2, states_1, - "\204\050\014\000\000\000\000\025\074\005\023\310\011\020\004\000\140\010\111\203\100"}, + "\204\050\014\000\000\000\000\025\074\005\023\310\011\020\004\000\140\010\311\040\040"}, {258, "eval_input", 0, 3, states_2, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\020\004\000\140\010\111\003\000"}, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\020\004\000\140\010\311\000\000"}, {259, "decorator", 0, 7, states_3, "\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {260, "decorators", 0, 2, states_4, @@ -1799,13 +1790,13 @@ static dfa dfas[84] = { {265, "fplist", 0, 3, states_9, "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {266, "stmt", 0, 2, states_10, - "\000\050\014\000\000\000\000\025\074\005\023\310\011\020\004\000\140\010\111\203\100"}, + "\000\050\014\000\000\000\000\025\074\005\023\310\011\020\004\000\140\010\311\040\040"}, {267, "simple_stmt", 0, 4, states_11, - "\000\040\010\000\000\000\000\025\074\005\023\000\000\020\004\000\140\010\111\003\100"}, + "\000\040\010\000\000\000\000\025\074\005\023\000\000\020\004\000\140\010\311\000\040"}, {268, "small_stmt", 0, 2, states_12, - "\000\040\010\000\000\000\000\025\074\005\023\000\000\020\004\000\140\010\111\003\100"}, + "\000\040\010\000\000\000\000\025\074\005\023\000\000\020\004\000\140\010\311\000\040"}, {269, "expr_stmt", 0, 6, states_13, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\020\004\000\140\010\111\003\000"}, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\020\004\000\140\010\311\000\000"}, {270, "augassign", 0, 2, states_14, "\000\000\000\000\000\360\377\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {271, "print_stmt", 0, 9, states_15, @@ -1815,7 +1806,7 @@ static dfa dfas[84] = { {273, "pass_stmt", 0, 2, states_17, "\000\000\000\000\000\000\000\020\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\074\000\000\000\000\000\000\000\000\000\000\000\100"}, + "\000\000\000\000\000\000\000\000\074\000\000\000\000\000\000\000\000\000\000\000\040"}, {275, "break_stmt", 0, 2, states_19, "\000\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000"}, {276, "continue_stmt", 0, 2, states_20, @@ -1823,7 +1814,7 @@ static dfa dfas[84] = { {277, "return_stmt", 0, 3, states_21, "\000\000\000\000\000\000\000\000\020\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\100"}, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\040"}, {279, "raise_stmt", 0, 7, states_23, "\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000"}, {280, "import_stmt", 0, 2, states_24, @@ -1849,7 +1840,7 @@ static dfa dfas[84] = { {290, "assert_stmt", 0, 5, states_34, "\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000"}, {291, "compound_stmt", 0, 2, states_35, - "\000\010\004\000\000\000\000\000\000\000\000\310\011\000\000\000\000\000\000\200\000"}, + "\000\010\004\000\000\000\000\000\000\000\000\310\011\000\000\000\000\000\000\040\000"}, {292, "if_stmt", 0, 8, states_36, "\000\000\000\000\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\000"}, {293, "while_stmt", 0, 8, states_37, @@ -1865,69 +1856,69 @@ static dfa dfas[84] = { {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\000\000\000\000\025\074\005\023\000\000\020\004\000\140\010\111\003\100"}, + "\004\040\010\000\000\000\000\025\074\005\023\000\000\020\004\000\140\010\311\000\040"}, {300, "testlist_safe", 0, 5, states_44, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\020\004\000\140\010\111\003\000"}, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\020\004\000\140\010\311\000\000"}, {301, "old_test", 0, 2, states_45, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\020\004\000\140\010\111\003\000"}, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\020\004\000\140\010\311\000\000"}, {302, "old_lambdef", 0, 5, states_46, "\000\000\000\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000"}, {303, "test", 0, 6, states_47, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\020\004\000\140\010\111\003\000"}, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\020\004\000\140\010\311\000\000"}, {304, "or_test", 0, 2, states_48, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\004\000\140\010\111\003\000"}, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\004\000\140\010\311\000\000"}, {305, "and_test", 0, 2, states_49, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\004\000\140\010\111\003\000"}, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\004\000\140\010\311\000\000"}, {306, "not_test", 0, 3, states_50, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\004\000\140\010\111\003\000"}, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\004\000\140\010\311\000\000"}, {307, "comparison", 0, 2, states_51, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\140\010\111\003\000"}, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\140\010\311\000\000"}, {308, "comp_op", 0, 4, states_52, "\000\000\000\000\000\000\000\000\000\000\010\000\000\000\344\017\000\000\000\000\000"}, {309, "expr", 0, 2, states_53, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\140\010\111\003\000"}, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\140\010\311\000\000"}, {310, "xor_expr", 0, 2, states_54, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\140\010\111\003\000"}, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\140\010\311\000\000"}, {311, "and_expr", 0, 2, states_55, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\140\010\111\003\000"}, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\140\010\311\000\000"}, {312, "shift_expr", 0, 2, states_56, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\140\010\111\003\000"}, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\140\010\311\000\000"}, {313, "arith_expr", 0, 2, states_57, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\140\010\111\003\000"}, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\140\010\311\000\000"}, {314, "term", 0, 2, states_58, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\140\010\111\003\000"}, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\140\010\311\000\000"}, {315, "factor", 0, 3, states_59, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\140\010\111\003\000"}, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\140\010\311\000\000"}, {316, "power", 0, 4, states_60, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\111\003\000"}, - {317, "atom", 0, 11, states_61, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\111\003\000"}, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\311\000\000"}, + {317, "atom", 0, 9, states_61, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\311\000\000"}, {318, "listmaker", 0, 5, states_62, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\020\004\000\140\010\111\003\000"}, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\020\004\000\140\010\311\000\000"}, {319, "testlist_gexp", 0, 5, states_63, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\020\004\000\140\010\111\003\000"}, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\020\004\000\140\010\311\000\000"}, {320, "lambdef", 0, 5, states_64, "\000\000\000\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000"}, {321, "trailer", 0, 7, states_65, "\000\040\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\001\000\000"}, {322, "subscriptlist", 0, 3, states_66, - "\000\040\050\000\000\000\000\000\000\010\000\000\000\020\004\000\140\010\111\003\000"}, + "\000\040\050\000\000\000\000\000\000\010\000\000\000\020\004\000\140\010\311\000\000"}, {323, "subscript", 0, 7, states_67, - "\000\040\050\000\000\000\000\000\000\010\000\000\000\020\004\000\140\010\111\003\000"}, + "\000\040\050\000\000\000\000\000\000\010\000\000\000\020\004\000\140\010\311\000\000"}, {324, "sliceop", 0, 3, states_68, "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {325, "exprlist", 0, 3, states_69, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\140\010\111\003\000"}, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\000\000\000\140\010\311\000\000"}, {326, "testlist", 0, 3, states_70, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\020\004\000\140\010\111\003\000"}, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\020\004\000\140\010\311\000\000"}, {327, "dictmaker", 0, 5, states_71, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\020\004\000\140\010\111\003\000"}, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\020\004\000\140\010\311\000\000"}, {328, "classdef", 0, 8, states_72, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\200\000"}, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\040\000"}, {329, "arglist", 0, 8, states_73, - "\000\040\010\060\000\000\000\000\000\000\000\000\000\020\004\000\140\010\111\003\000"}, + "\000\040\010\060\000\000\000\000\000\000\000\000\000\020\004\000\140\010\311\000\000"}, {330, "argument", 0, 4, states_74, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\020\004\000\140\010\111\003\000"}, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\020\004\000\140\010\311\000\000"}, {331, "list_iter", 0, 2, states_75, "\000\000\000\000\000\000\000\000\000\000\000\210\000\000\000\000\000\000\000\000\000"}, {332, "list_for", 0, 6, states_76, @@ -1941,13 +1932,13 @@ static dfa dfas[84] = { {336, "gen_if", 0, 4, states_80, "\000\000\000\000\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\000"}, {337, "testlist1", 0, 2, states_81, - "\000\040\010\000\000\000\000\000\000\000\000\000\000\020\004\000\140\010\111\003\000"}, + "\000\040\010\000\000\000\000\000\000\000\000\000\000\020\004\000\140\010\311\000\000"}, {338, "encoding_decl", 0, 2, states_82, "\000\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {339, "yield_expr", 0, 3, states_83, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\100"}, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\040"}, }; -static label labels[167] = { +static label labels[166] = { {0, "EMPTY"}, {256, 0}, {4, 0}, @@ -2098,8 +2089,6 @@ static label labels[167] = { {26, 0}, {327, 0}, {27, 0}, - {25, 0}, - {337, 0}, {2, 0}, {3, 0}, {332, 0}, @@ -2113,12 +2102,13 @@ static label labels[167] = { {333, 0}, {334, 0}, {336, 0}, + {337, 0}, {338, 0}, {1, "yield"}, }; grammar _PyParser_Grammar = { 84, dfas, - {167, labels}, + {166, labels}, 256 }; |