aboutsummaryrefslogtreecommitdiff
path: root/py/grammar.h
diff options
context:
space:
mode:
authorDamien George2015-10-08 14:26:01 +0100
committerDamien George2015-10-08 14:26:01 +0100
commitb948de36fb852aa1f9991cb3cc1ffc3b31813acd (patch)
tree6363c4eaeef6d1e024c056536bb9d5822d8ebb37 /py/grammar.h
parent4fb5ff86eed74e7816f4126d5220830fcbb0a393 (diff)
py: Don't generate unnecessary parse nodes for assignment or kwargs.
This patch eliminates the need for a nested parse node for assignments and keyword arguments. It saves a little bit of RAM when parsing.
Diffstat (limited to 'py/grammar.h')
-rw-r--r--py/grammar.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/py/grammar.h b/py/grammar.h
index 3f6668808..03b15992d 100644
--- a/py/grammar.h
+++ b/py/grammar.h
@@ -98,7 +98,7 @@ DEF_RULE(expr_stmt, c(expr_stmt), and(2), rule(testlist_star_expr), opt_rule(exp
DEF_RULE(expr_stmt_2, nc, or(2), rule(expr_stmt_augassign), rule(expr_stmt_assign_list))
DEF_RULE(expr_stmt_augassign, nc, and(2), rule(augassign), rule(expr_stmt_6))
DEF_RULE(expr_stmt_assign_list, nc, one_or_more, rule(expr_stmt_assign))
-DEF_RULE(expr_stmt_assign, nc, and(2), tok(DEL_EQUAL), rule(expr_stmt_6))
+DEF_RULE(expr_stmt_assign, nc, ident | and(2), tok(DEL_EQUAL), rule(expr_stmt_6))
DEF_RULE(expr_stmt_6, nc, or(2), rule(yield_expr), rule(testlist_star_expr))
DEF_RULE(testlist_star_expr, c(generic_tuple), list_with_end, rule(testlist_star_expr_2), tok(DEL_COMMA))
DEF_RULE(testlist_star_expr_2, nc, or(2), rule(star_expr), rule(test))
@@ -322,7 +322,7 @@ DEF_RULE(arglist_dbl_star, nc, and(2), tok(OP_DBL_STAR), rule(test))
DEF_RULE(argument, nc, and(2), rule(test), opt_rule(argument_2))
DEF_RULE(argument_2, nc, or(2), rule(comp_for), rule(argument_3))
-DEF_RULE(argument_3, nc, and(2), tok(DEL_EQUAL), rule(test))
+DEF_RULE(argument_3, nc, ident | and(2), tok(DEL_EQUAL), rule(test))
DEF_RULE(comp_iter, nc, or(2), rule(comp_for), rule(comp_if))
DEF_RULE(comp_for, nc, blank | and(5), tok(KW_FOR), rule(exprlist), tok(KW_IN), rule(or_test), opt_rule(comp_iter))
DEF_RULE(comp_if, nc, and(3), tok(KW_IF), rule(test_nocond), opt_rule(comp_iter))