From 9e8df0750f7639c78f6130236435c76915c1b6fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vili=20Sinerv=C3=A4?= Date: Fri, 31 Jan 2025 15:42:09 +0200 Subject: [PATCH] Add comments with precedence levels --- src/compiler/parser/mod.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/compiler/parser/mod.rs b/src/compiler/parser/mod.rs index ef286ae..70d4b41 100644 --- a/src/compiler/parser/mod.rs +++ b/src/compiler/parser/mod.rs @@ -28,14 +28,15 @@ fn parse_expression<'source>( tokens: &[Token<'source>], ) -> Expression<'source> { const OPS: [&[&str]; 8] = [ - &["="], - &["or"], - &["and"], - &["==", "!="], - &["<", "<=", "=>", ">"], - &["+", "-"], - &["*", "/", "%"], - &["not", "-"], + &["="], // 0 + &["or"], // 1 + &["and"], // 2 + &["==", "!="], // 3 + &["<", "<=", "=>", ">"], // 4 + &["+", "-"], // 5 + &["*", "/", "%"], // 6 + &["not", "-"], // 7 + // 8 ]; match level {