Fix uppercase/lowercase, add custom_binop to e2e tests
This commit is contained in:
		
							parent
							
								
									a09bccb255
								
							
						
					
					
						commit
						25fb6bf0fd
					
				| @ -363,14 +363,17 @@ pub fn tokenize<T: Into<String>>(to_tokenize: T) -> Result<Vec<FullToken>, Error | |||||||
|                 let mut value = NumberType::Decimal(character.to_string()); |                 let mut value = NumberType::Decimal(character.to_string()); | ||||||
|                 let mut numerics = DECIMAL_NUMERICS; |                 let mut numerics = DECIMAL_NUMERICS; | ||||||
|                 if let Some(second) = cursor.second() { |                 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(); |                         cursor.next(); | ||||||
|                         value = NumberType::Hexadecimal(String::new()); |                         value = NumberType::Hexadecimal(String::new()); | ||||||
|                         numerics = HEXADECIMAL_NUMERICS; |                         numerics = HEXADECIMAL_NUMERICS; | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|                 while let Some(c) = cursor.first() { |                 while let Some(c) = cursor.first() { | ||||||
|                     if !numerics.contains(&c) { |                     if !numerics.contains(&c.to_lowercase().next().unwrap_or('.')) { | ||||||
|                         break; |                         break; | ||||||
|                     } |                     } | ||||||
|                     value += c; |                     value += c; | ||||||
|  | |||||||
| @ -132,3 +132,7 @@ fn ptr_hard_compiles_well() { | |||||||
| fn loop_hard_compiles_well() { | fn loop_hard_compiles_well() { | ||||||
|     test(include_str!("../../examples/loop_hard.reid"), "test", 0); |     test(include_str!("../../examples/loop_hard.reid"), "test", 0); | ||||||
| } | } | ||||||
|  | #[test] | ||||||
|  | fn custom_binop_compiles_well() { | ||||||
|  |     test(include_str!("../../examples/custom_binop.reid"), "test", 21); | ||||||
|  | } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user