From 8947521181eb1c4719662e344774636f9a062124 Mon Sep 17 00:00:00 2001 From: John Breaux Date: Sat, 19 Aug 2023 23:56:26 -0500 Subject: [PATCH] token.rs: Allow one-character identifiers --- src/tokenizer/token.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tokenizer/token.rs b/src/tokenizer/token.rs index d86c67e..ac0729e 100644 --- a/src/tokenizer/token.rs +++ b/src/tokenizer/token.rs @@ -50,7 +50,7 @@ impl<$t> From<&$t str> for $type { token } else )* - {todo!("Unexpected input: {value:#?}")} + {todo!("Unexpected input: {value:#?} (Tokenization failure)")} } } }; @@ -221,7 +221,7 @@ regex_impl! {<'text> Token<'text> { regex!(Type::Directive = r"^\.\w+( .*)?") } pub fn expect_identifier(text: &str) -> Option { - regex!(Type::Identifier = r"^[A-Za-z_]\w+") + regex!(Type::Identifier = r"^[A-Za-z_]\w*") } pub fn expect_separator(text: &str) -> Option { regex!(Type::Separator = r"^,")