Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/lpython/parser/parser.yy
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,15 @@ function_call
| primary "(" keyword_items comma_opt ")" { $$ = CALL_03($1, $3, @$); }
| primary "(" expr comp_for_items ")" {
$$ = CALL_04($1, GENERATOR_EXPR($3, $4, @$), @$); }
| function_call "(" expr_list_opt ")" { $$ = CALL_01($1, $3, @$); }
| function_call "(" expr_list "," ")" { $$ = CALL_01($1, $3, @$); }
| function_call "(" expr_list "," keyword_items comma_opt ")" {
$$ = CALL_02($1, $3, $5, @$); }
| function_call "(" keyword_items "," expr_list comma_opt ")" {
$$ = CALL_02($1, $5, $3, @$); }
| function_call "(" keyword_items comma_opt ")" { $$ = CALL_03($1, $3, @$); }
| function_call "(" expr comp_for_items ")" {
$$ = CALL_04($1, GENERATOR_EXPR($3, $4, @$), @$); }
;

subscription
Expand Down
3 changes: 3 additions & 0 deletions tests/parser/statements2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
getattr(x, y)(a, b,)(5, a=a, b=0)
func(a, _op)(s)
test()()
13 changes: 13 additions & 0 deletions tests/reference/ast_new-statements2-c4cdc5f.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"basename": "ast_new-statements2-c4cdc5f",
"cmd": "lpython --show-ast --new-parser --no-color {infile} -o {outfile}",
"infile": "tests/parser/statements2.py",
"infile_hash": "2b7785ebfba06ec07891cd50f2e66555218192c04730e11574f8db4e",
"outfile": null,
"outfile_hash": null,
"stdout": "ast_new-statements2-c4cdc5f.stdout",
"stdout_hash": "96a46e9c67a48061b16c6486fa0df0bb587c38fff1a6c2e77ae0459f",
"stderr": null,
"stderr_hash": null,
"returncode": 0
}
1 change: 1 addition & 0 deletions tests/reference/ast_new-statements2-c4cdc5f.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(Module [(Expr (Call (Call (Call (Name getattr Load) [(Name x Load) (Name y Load)] []) [(Name a Load) (Name b Load)] []) [(ConstantInt 5 ())] [(a (Name a Load)) (b (ConstantInt 0 ()))])) (Expr (Call (Call (Name func Load) [(Name a Load) (Name _op Load)] []) [(Name s Load)] [])) (Expr (Call (Call (Name test Load) [] []) [] []))] [])
4 changes: 4 additions & 0 deletions tests/tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,10 @@ ast_new = true
filename = "parser/statements1.py"
ast_new = true

[[test]]
filename = "parser/statements2.py"
ast_new = true

[[test]]
filename = "parser/yield.py"
ast_new = true
Expand Down