mirror of
https://github.com/python/cpython.git
synced 2025-10-03 05:35:59 +00:00
bpo-43798: Add source location attributes to alias (GH-25324)
* Add source location attributes to alias. * Move alias star construction to pegen helper. Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
This commit is contained in:
parent
e05a703848
commit
75a06f067b
11 changed files with 199 additions and 19 deletions
|
@ -144,20 +144,20 @@ import_from[stmt_ty]:
|
|||
import_from_targets[asdl_alias_seq*]:
|
||||
| '(' a=import_from_as_names [','] ')' { a }
|
||||
| import_from_as_names !','
|
||||
| '*' { (asdl_alias_seq*)_PyPegen_singleton_seq(p, CHECK(alias_ty, _PyPegen_alias_for_star(p))) }
|
||||
| '*' { (asdl_alias_seq*)_PyPegen_singleton_seq(p, CHECK(alias_ty, _PyPegen_alias_for_star(p, EXTRA))) }
|
||||
| invalid_import_from_targets
|
||||
import_from_as_names[asdl_alias_seq*]:
|
||||
| a[asdl_alias_seq*]=','.import_from_as_name+ { a }
|
||||
import_from_as_name[alias_ty]:
|
||||
| a=NAME b=['as' z=NAME { z }] { _PyAST_alias(a->v.Name.id,
|
||||
(b) ? ((expr_ty) b)->v.Name.id : NULL,
|
||||
p->arena) }
|
||||
EXTRA) }
|
||||
dotted_as_names[asdl_alias_seq*]:
|
||||
| a[asdl_alias_seq*]=','.dotted_as_name+ { a }
|
||||
dotted_as_name[alias_ty]:
|
||||
| a=dotted_name b=['as' z=NAME { z }] { _PyAST_alias(a->v.Name.id,
|
||||
(b) ? ((expr_ty) b)->v.Name.id : NULL,
|
||||
p->arena) }
|
||||
EXTRA) }
|
||||
dotted_name[expr_ty]:
|
||||
| a=dotted_name '.' b=NAME { _PyPegen_join_names_with_dot(p, a, b) }
|
||||
| NAME
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue