aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--progs/tests/tuples.sy3
-rw-r--r--src/compiler.rs3
2 files changed, 5 insertions, 1 deletions
diff --git a/progs/tests/tuples.sy b/progs/tests/tuples.sy
index f2fcfcb..642e381 100644
--- a/progs/tests/tuples.sy
+++ b/progs/tests/tuples.sy
@@ -14,7 +14,8 @@ start :: fn {
d[0] <=> d[0]
{
- q := d[0]
+ q := d[2-2]
+ d[d[(5 + 3) * 0]] <=> d[d[(5 + 3) * 0]]
w := d[0]
q + w
q - w
diff --git a/src/compiler.rs b/src/compiler.rs
index b2900b6..c04a36f 100644
--- a/src/compiler.rs
+++ b/src/compiler.rs
@@ -186,6 +186,7 @@ nextable_enum!(Prec {
Comp,
Term,
Factor,
+ Index,
});
#[derive(Clone, Debug)]
@@ -603,6 +604,8 @@ impl Compiler {
fn precedence(&self, token: Token) -> Prec {
match token {
+ Token::LeftBracket => Prec::Index,
+
Token::Star | Token::Slash => Prec::Factor,
Token::Minus | Token::Plus => Prec::Term,