Skip to content

Commit

Permalink
Allow using the Unicode not equal to character as an inequality operator
Browse files Browse the repository at this point in the history
  • Loading branch information
haykam821 committed Mar 5, 2024
1 parent 1fb2c93 commit 9f028eb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions core/src/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,7 @@ fn parse_symbol(ch: char, input: &mut &str) -> FResult<Token> {
Symbol::Equals
}
}
'\u{2260}' => Symbol::NotEquals, // unicode not equal to symbol
'\\' | '\u{3bb}' => Symbol::Backslash, // lambda symbol
'.' => Symbol::Dot,
'<' => {
Expand Down
2 changes: 2 additions & 0 deletions core/tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 9f028eb

Please sign in to comment.