Closed
Description
Example:
prm_tup = tuple(next(parameters) for _ in i.__parameters__)
Old Parser Output:
$ lpython --show-ast examples/expr2.py --tree
└-Module
|-body=↧
| └-Assign
| |-targets=↧
| | └-Name
| | |-id=prm_tup
| | └-expr_contextType=Store
| |-value=Call
| | |-func=Name
| | | |-id=tuple
| | | └-expr_contextType=Load
| | |-args=↧
| | | └-GeneratorExp
| | | |-elt=Call
| | | | |-func=Name
| | | | | |-id=next
| | | | | └-expr_contextType=Load
| | | | |-args=↧
| | | | | └-Name
| | | | | |-id=parameters
| | | | | └-expr_contextType=Load
| | | | └-keywords=↧
| | | └-generators=↧
| | | └-
| | | |-target=Name
| | | | |-id=_
| | | | └-expr_contextType=Store
| | | |-iter=Attribute
| | | | |-value=Name
| | | | | |-id=i
| | | | | └-expr_contextType=Load
| | | | |-attr=__parameters__
| | | | └-expr_contextType=Load
| | | |-ifs=↧
| | | └-is_async=0
| | └-keywords=↧
| └-type_comment=()
└-type_ignores=↧
Error:
$ lpython --show-ast examples/expr2.py --tree --new-parser
syntax error: Token 'for' is unexpected here
--> examples/expr2.py:1:34
|
1 | prm_tup = tuple(next(parameters) for _ in i.__parameters__)
| ^^^