summaryrefslogtreecommitdiffstats
path: root/Parser
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2020-03-10 16:52:34 (GMT)
committerGitHub <noreply@github.com>2020-03-10 16:52:34 (GMT)
commit13d52c268699f199a8e917a0f1dc4c51e5346c42 (patch)
treed602c97d77e3222d38c6300ed822021e51bd9dce /Parser
parente5e56328afac50aad6d8893185d8e7ba8928afe2 (diff)
downloadcpython-13d52c268699f199a8e917a0f1dc4c51e5346c42.zip
cpython-13d52c268699f199a8e917a0f1dc4c51e5346c42.tar.gz
cpython-13d52c268699f199a8e917a0f1dc4c51e5346c42.tar.bz2
bpo-34822: Simplify AST for subscription. (GH-9605)
* Remove the slice type. * Make Slice a kind of the expr type instead of the slice type. * Replace ExtSlice(slices) with Tuple(slices, Load()). * Replace Index(value) with a value itself. All non-terminal nodes in AST for expressions are now of the expr type.
Diffstat (limited to 'Parser')
-rw-r--r--Parser/Python.asdl9
1 files changed, 4 insertions, 5 deletions
diff --git a/Parser/Python.asdl b/Parser/Python.asdl
index bec30a7..a1ddebd 100644
--- a/Parser/Python.asdl
+++ b/Parser/Python.asdl
@@ -78,21 +78,20 @@ module Python
-- the following expression can appear in assignment context
| Attribute(expr value, identifier attr, expr_context ctx)
- | Subscript(expr value, slice slice, expr_context ctx)
+ | Subscript(expr value, expr slice, expr_context ctx)
| Starred(expr value, expr_context ctx)
| Name(identifier id, expr_context ctx)
| List(expr* elts, expr_context ctx)
| Tuple(expr* elts, expr_context ctx)
+ -- can appear only in Subscript
+ | Slice(expr? lower, expr? upper, expr? step)
+
-- col_offset is the byte offset in the utf8 string the parser uses
attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset)
expr_context = Load | Store | Del | AugLoad | AugStore | Param
- slice = Slice(expr? lower, expr? upper, expr? step)
- | ExtSlice(slice* dims)
- | Index(expr value)
-
boolop = And | Or
operator = Add | Sub | Mult | MatMult | Div | Mod | Pow | LShift