Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Support math expressions as array indexes #50

Merged
merged 1 commit into from
Mar 13, 2024
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
2 changes: 1 addition & 1 deletion src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1449,7 +1449,7 @@ impl Parser {
// Indexing operation
self.next();

let item = self.simple_expression();
let item = self.expression();
let span_end = self.position() + 1;
self.rsquare();

Expand Down
7 changes: 7 additions & 0 deletions tests/integration/math/math_in_brackets.june
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// output: 23
mut data = raw[1,2,3]
unsafe {
println(data[1])
data[0 + 1] = 3
println(data[1])
}