From d069f037a79b67e9197b2d6467e66c7ed3ee3c57 Mon Sep 17 00:00:00 2001 From: Slendi Date: Tue, 9 Apr 2024 02:37:52 +0300 Subject: [PATCH] Fix order of operations for bitwise stuff Signed-off-by: Slendi --- src/parser.odin | 11 ++++++----- test_type_checker.cat | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/parser.odin b/src/parser.odin index 48c7ce6..3b41f49 100644 --- a/src/parser.odin +++ b/src/parser.odin @@ -469,11 +469,12 @@ parser_parse_exponent :: proc(parser: ^Parser) -> ^Node { @(private = "file") parser_parse_bitwise :: proc(parser: ^Parser) -> ^Node { - return parser_parse_binary_expression( - parser, - {.BitwiseAnd, .BitwiseOr, .BitwiseXOR, .BitwiseLeftShift, .BitwiseRightShift}, - parser_parse_prefix_2, - ) + return parser_parse_binary_expression(parser, {.BitwiseAnd, .BitwiseOr, .BitwiseXOR}, parser_parse_bitwise1) +} + +@(private = "file") +parser_parse_bitwise1 :: proc(parser: ^Parser) -> ^Node { + return parser_parse_binary_expression(parser, {.BitwiseLeftShift, .BitwiseRightShift}, parser_parse_prefix_2) } @(private = "file") diff --git a/test_type_checker.cat b/test_type_checker.cat index 8f57595..6459773 100644 --- a/test_type_checker.cat +++ b/test_type_checker.cat @@ -15,7 +15,7 @@ fn DrawFPS(x y: i32) fn WindowShouldClose i32 fn ColorToRaylib(c: Color) u32 { - ret (c.a as u32 << 24 as u32) | (c.b as u32 << 16 as u32) | (c.g as u32 << 8 as u32) | c.r + ret c.a as u32 << 24 as u32 | c.b as u32 << 16 as u32 | c.g as u32 << 8 as u32 | c.r } fn ClearBackgroundWrap(c: Color) {