From 8459dea8fb961062190bb78e6fdf041e2a4e25f4 Mon Sep 17 00:00:00 2001 From: Sofia Date: Mon, 11 May 2026 16:30:28 +0300 Subject: [PATCH] Fix parsing double character binops --- src/parsing.cpp | 6 ++++++ test.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/parsing.cpp b/src/parsing.cpp index 6cc761d..d9e777c 100644 --- a/src/parsing.cpp +++ b/src/parsing.cpp @@ -475,26 +475,32 @@ namespace parsing { } else if (token.content == "<" && peeked.content == "<") { + inner.next(); stream.m_position = inner.m_position; return types::BinOp{ types::BinOp::BitShiftLeft }; } else if (token.content == ">" && peeked.content == ">") { + inner.next(); stream.m_position = inner.m_position; return types::BinOp{ types::BinOp::BitShiftRight }; } else if (token.content == "<" && peeked.content == "=") { + inner.next(); stream.m_position = inner.m_position; return types::BinOp{ types::BinOp::LessThanEquals }; } else if (token.content == ">" && peeked.content == "=") { + inner.next(); stream.m_position = inner.m_position; return types::BinOp{ types::BinOp::GreaterThanEquals }; } else if (token.content == "=" && peeked.content == "=") { + inner.next(); stream.m_position = inner.m_position; return types::BinOp{ types::BinOp::Equals }; } else if (token.content == "!" && peeked.content == "=") { + inner.next(); stream.m_position = inner.m_position; return types::BinOp{ types::BinOp::NotEquals }; } diff --git a/test.c b/test.c index 2991a86..4eed809 100644 --- a/test.c +++ b/test.c @@ -73,5 +73,5 @@ long long int main() { short int sh = 123 + 5; - return sh % 10; + return (sh % 10) == 8; } \ No newline at end of file