Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b66524a

Browse filesBrowse files
committed
Use a loop to collect args in the parser instead of recursion
1 parent 9b648a9 commit b66524a
Copy full SHA for b66524a

File tree

Expand file treeCollapse file tree

4 files changed

+626
-515
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+626
-515
lines changed

‎Grammar/python.gram

Copy file name to clipboardExpand all lines: Grammar/python.gram
+1-12Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -535,22 +535,11 @@ arguments[expr_ty] (memo):
535535
| a=args [','] &')' { a }
536536
| incorrect_arguments
537537
args[expr_ty]:
538-
| a=starred_expression b=[',' c=args { c }] {
539-
_Py_Call(_PyPegen_dummy_name(p),
540-
(b) ? CHECK(_PyPegen_seq_insert_in_front(p, a, ((expr_ty) b)->v.Call.args))
541-
: CHECK(_PyPegen_singleton_seq(p, a)),
542-
(b) ? ((expr_ty) b)->v.Call.keywords : NULL,
543-
EXTRA) }
538+
| a=','.(starred_expression | named_expression !'=')+ b=[',' k=kwargs {k}] { _PyPegen_collect_call_seqs(p, a, b) }
544539
| a=kwargs { _Py_Call(_PyPegen_dummy_name(p),
545540
CHECK_NULL_ALLOWED(_PyPegen_seq_extract_starred_exprs(p, a)),
546541
CHECK_NULL_ALLOWED(_PyPegen_seq_delete_starred_exprs(p, a)),
547542
EXTRA) }
548-
| a=named_expression b=[',' c=args { c }] {
549-
_Py_Call(_PyPegen_dummy_name(p),
550-
(b) ? CHECK(_PyPegen_seq_insert_in_front(p, a, ((expr_ty) b)->v.Call.args))
551-
: CHECK(_PyPegen_singleton_seq(p, a)),
552-
(b) ? ((expr_ty) b)->v.Call.keywords : NULL,
553-
EXTRA) }
554543
kwargs[asdl_seq*]:
555544
| a=','.kwarg_or_starred+ ',' b=','.kwarg_or_double_starred+ { _PyPegen_join_sequences(p, a, b) }
556545
| ','.kwarg_or_starred+

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.