Skip to content

Commit 2125fdb

Browse files
committed
fix: InlineList doesn't accept multi-line list definitions
1 parent 0cbc5c8 commit 2125fdb

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

src/compiler/parser.rs

+4
Original file line numberDiff line numberDiff line change
@@ -3514,6 +3514,10 @@ impl Parser {
35143514
"emit" => "identifier",
35153515
"value" => "_"
35163516
])),
3517+
(value!([
3518+
"emit" => "identifier",
3519+
"value" => "___"
3520+
])),
35173521
(value!([
35183522
"emit" => "identifier",
35193523
"value" => "InlineAssignment"

src/compiler/tokay.tok

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ InlineSequences : @{
218218
}
219219

220220
InlineList : @{
221-
InlineAssignment ___ (',' _ InlineAssignment ___)+ (',' _)? ___ ast("list")
221+
InlineAssignment ___ (',' _ ___ InlineAssignment ___)+ (',' _)? ___ ast("list")
222222
InlineAssignment? ___ (',' _) ___ ast("list")
223223
}
224224

tests/syntax_inline_list.tok

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
for dir in (
2+
(-1, -1),
3+
(-1, 0),
4+
(-1, 1),
5+
)
6+
print(dir)
7+
8+
#---
9+
#(-1, -1)
10+
#(-1, 0)
11+
#(-1, 1)

0 commit comments

Comments
 (0)