From 25fb6bf0fd929fdda5586511c727ad2cc5c2385f Mon Sep 17 00:00:00 2001 From: sofia Date: Thu, 24 Jul 2025 21:26:32 +0300 Subject: [PATCH] Fix uppercase/lowercase, add custom_binop to e2e tests --- reid/src/lexer.rs | 7 +++++-- reid/tests/e2e.rs | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/reid/src/lexer.rs b/reid/src/lexer.rs index 3a1d477..e786ae8 100644 --- a/reid/src/lexer.rs +++ b/reid/src/lexer.rs @@ -363,14 +363,17 @@ pub fn tokenize>(to_tokenize: T) -> Result, Error let mut value = NumberType::Decimal(character.to_string()); let mut numerics = DECIMAL_NUMERICS; if let Some(second) = cursor.second() { - if cursor.first() == Some('x') && HEXADECIMAL_NUMERICS.contains(&second) { + if cursor.first() == Some('x') + && HEXADECIMAL_NUMERICS + .contains(&second.to_lowercase().next().unwrap_or('.')) + { cursor.next(); value = NumberType::Hexadecimal(String::new()); numerics = HEXADECIMAL_NUMERICS; } } while let Some(c) = cursor.first() { - if !numerics.contains(&c) { + if !numerics.contains(&c.to_lowercase().next().unwrap_or('.')) { break; } value += c; diff --git a/reid/tests/e2e.rs b/reid/tests/e2e.rs index 61e9815..5b16a47 100644 --- a/reid/tests/e2e.rs +++ b/reid/tests/e2e.rs @@ -132,3 +132,7 @@ fn ptr_hard_compiles_well() { fn loop_hard_compiles_well() { test(include_str!("../../examples/loop_hard.reid"), "test", 0); } +#[test] +fn custom_binop_compiles_well() { + test(include_str!("../../examples/custom_binop.reid"), "test", 21); +}