Skip to content

Commit

Permalink
shorthand arguments from @__hels__
Browse files Browse the repository at this point in the history
  • Loading branch information
thatbirdguythatuknownot committed Oct 24, 2023
1 parent 6eff0fd commit ec72c74
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
8 changes: 4 additions & 4 deletions Grammar/python.gram
Original file line number Diff line number Diff line change
Expand Up @@ -1074,14 +1074,14 @@ starred_expression[expr_ty]:

kwarg_or_starred[KeywordOrStarred*]:
| invalid_kwarg
| a=NAME '=' b=expression {
_PyPegen_keyword_or_starred(p, CHECK(keyword_ty, _PyAST_keyword(a->v.Name.id, b, EXTRA)), 1) }
| a=NAME '=' b=expression? {
_PyPegen_keyword_or_starred(p, CHECK(keyword_ty, _PyAST_keyword(a->v.Name.id, b ? b : a, EXTRA)), 1) }
| a=starred_expression { _PyPegen_keyword_or_starred(p, a, 0) }

kwarg_or_double_starred[KeywordOrStarred*]:
| invalid_kwarg
| a=NAME '=' b=expression {
_PyPegen_keyword_or_starred(p, CHECK(keyword_ty, _PyAST_keyword(a->v.Name.id, b, EXTRA)), 1) }
| a=NAME '=' b=expression? {
_PyPegen_keyword_or_starred(p, CHECK(keyword_ty, _PyAST_keyword(a->v.Name.id, b ? b : a, EXTRA)), 1) }
| '**' a=expression { _PyPegen_keyword_or_starred(p, CHECK(keyword_ty, _PyAST_keyword(NULL, a, EXTRA)), 1) }

# ASSIGNMENT TARGETS
Expand Down
32 changes: 16 additions & 16 deletions Parser/parser.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 comment on commit ec72c74

@thatbirdguythatuknownot
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.