Skip to content

Commit 3ca90de

Browse files
committed
Recognise *id as a valid id_item
1 parent 4df26ca commit 3ca90de

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/lpython/parser/parser.yy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,7 @@ id_list
825825

826826
id_item
827827
: id { $$ = $1; }
828+
| "*" id { $$ = STARRED_ARG_STORE($2, @$); }
828829
| "(" id ")" { $$ = $2; }
829830
| "(" id_list "," ")" { $$ = ID_TUPLE_03($2, @$); }
830831
| "(" id_list "," id_item ")" { $$ = ID_TUPLE_01(TUPLE_($2, $4), @$); }

src/lpython/parser/semantics.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -964,6 +964,8 @@ ast_t *DICT1(Allocator &al, Location &l, Vec<Key_Val*> dict_list) {
964964
EXPR(SET_EXPR_CTX_01(x, Store)), EXPR(y))
965965
#define STARRED_ARG(e, l) make_Starred_t(p.m_a, l, \
966966
EXPR(e), expr_contextType::Load)
967+
#define STARRED_ARG_STORE(e, l) make_Starred_t(p.m_a, l, \
968+
EXPR(SET_EXPR_CTX_01(e, Store)), expr_contextType::Load)
967969
#define LAMBDA_01(args, e, l) make_Lambda_t(p.m_a, l, args->arguments, EXPR(e))
968970

969971
#endif

0 commit comments

Comments
 (0)