diff options
author | Damien George <damien.p.george@gmail.com> | 2016-03-16 13:04:51 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2016-03-16 13:04:51 +0000 |
commit | 3acaa28b52587bace3a4e8382fbf06ed6f6e4aaf (patch) | |
tree | 1bef0f7d436e459f0df8568da8461e237fb7f80a /py/grammar.h | |
parent | 52e062ef3396bb94381073547f0dff7b36a6815d (diff) | |
download | micropython-3acaa28b52587bace3a4e8382fbf06ed6f6e4aaf.tar.gz micropython-3acaa28b52587bace3a4e8382fbf06ed6f6e4aaf.zip |
py: Don't allocate an extra parse node for power exponent.
Previous to this patch, the "**b" in "a**b" had its own parse node with
just one item (the "b"). Now, the "b" is just the last element of the
power parse-node. This saves (a tiny bit of) RAM when compiling.
Diffstat (limited to 'py/grammar.h')
-rw-r--r-- | py/grammar.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/py/grammar.h b/py/grammar.h index b7036c8ecd..a7d1b41e6c 100644 --- a/py/grammar.h +++ b/py/grammar.h @@ -241,7 +241,7 @@ DEF_RULE(factor_2, c(factor_2), and(2), rule(factor_op), rule(factor)) DEF_RULE(factor_op, nc, or(3), tok(OP_PLUS), tok(OP_MINUS), tok(OP_TILDE)) DEF_RULE(power, c(power), and(3), rule(atom), opt_rule(power_trailers), opt_rule(power_dbl_star)) DEF_RULE(power_trailers, c(power_trailers), one_or_more, rule(trailer)) -DEF_RULE(power_dbl_star, c(power_dbl_star), and(2), tok(OP_DBL_STAR), rule(factor)) +DEF_RULE(power_dbl_star, nc, ident | and(2), tok(OP_DBL_STAR), rule(factor)) // atom: '(' [yield_expr|testlist_comp] ')' | '[' [testlist_comp] ']' | '{' [dictorsetmaker] '}' | NAME | NUMBER | STRING+ | '...' | 'None' | 'True' | 'False' // testlist_comp: (test|star_expr) ( comp_for | (',' (test|star_expr))* [','] ) |