From 3f726c9fb9c9b5a0d6b963e6a1d4a85583914741 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20=C4=8Euri=C5=A1?= Date: Tue, 23 Apr 2024 11:08:57 +0200 Subject: [PATCH] fix regex patterns --- src/lexer/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lexer/mod.rs b/src/lexer/mod.rs index 91e6b31..314d3ef 100644 --- a/src/lexer/mod.rs +++ b/src/lexer/mod.rs @@ -98,13 +98,13 @@ pub(crate) enum LogosToken { #[regex(r"/(([^\\/\n])|(\\.))+/[a-zA-Z0-9]*", |lex| lex.slice().to_string())] Regexp(String), // Hexadecimal string - #[regex(r"=\s\{(([\s0-9A-Fa-f?~()|\[\] -]|//.*)*)\}", |lex| lex.slice().to_string())] + #[regex(r"=[ \n]{0,10}\{(([\s0-9A-Fa-f?~()|\[\] -]|//.*)*)\}", |lex| lex.slice().to_string())] HexString(String), // Strings #[regex(r#""(([^"\\]|\\x[0-9a-fA-F]{2}|\\[trn"\\]|\\.)*)""#, |lex| lex.slice().to_string())] String(String), // Identifiers - #[regex(r"[a-zA-Z][a-zA-Z0-9_]*", |lex| lex.slice().to_string())] + #[regex(r"[a-zA-Z0-9_]*", |lex| lex.slice().to_string())] Identifier(String), // Variables #[regex(r"\$[a-zA-Z0-9_]*", |lex| lex.slice().to_string())] @@ -236,7 +236,7 @@ pub(crate) enum HexLogosToken { Whitespace, #[regex(r"~?[0-9a-fA-F?]{2}")] Lit, - #[regex(r"\[\-?[0-9]*\-?[0-9]*\]")] + #[regex(r"\[\-?[0-9]* ?\-? ?[0-9]*\]")] Range, #[regex(r"//.*")] Comment,