From 9f028eb70e1f47660f8f0c9f2bbb6f8fd980768d Mon Sep 17 00:00:00 2001 From: haykam821 <24855774+haykam821@users.noreply.github.com> Date: Tue, 5 Mar 2024 16:34:00 -0500 Subject: [PATCH] Allow using the Unicode not equal to character as an inequality operator --- core/src/lexer.rs | 1 + core/tests/integration_tests.rs | 2 ++ 2 files changed, 3 insertions(+) diff --git a/core/src/lexer.rs b/core/src/lexer.rs index 4ecc3c4f..483ab38e 100644 --- a/core/src/lexer.rs +++ b/core/src/lexer.rs @@ -539,6 +539,7 @@ fn parse_symbol(ch: char, input: &mut &str) -> FResult { Symbol::Equals } } + '\u{2260}' => Symbol::NotEquals, // unicode not equal to symbol '\\' | '\u{3bb}' => Symbol::Backslash, // lambda symbol '.' => Symbol::Dot, '<' => { diff --git a/core/tests/integration_tests.rs b/core/tests/integration_tests.rs index 432bdae3..4851038a 100644 --- a/core/tests/integration_tests.rs +++ b/core/tests/integration_tests.rs @@ -5878,8 +5878,10 @@ fn test_superscript() { fn test_equality() { test_eval("1 + 2 == 3", "true"); test_eval("1 + 2 != 4", "true"); + test_eval("1 + 2 ≠ 4", "true"); test_eval("true == false", "false"); test_eval("true != false", "true"); + test_eval("true ≠ false", "true"); test_eval("2m == 200cm", "true"); test_eval("2kg == 200cm", "false"); test_eval("2kg == true", "false");