From c947691f750d772aef5fbb2b5833d0aff3ebe6d6 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Thu, 4 Jul 2024 13:32:00 -0700 Subject: [PATCH] fix regex and remove --! because luau doesn't like it --- rox_compiler/src/common.rs | 6 +++--- rox_compiler/src/compile.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rox_compiler/src/common.rs b/rox_compiler/src/common.rs index 970aec9..3183e4d 100644 --- a/rox_compiler/src/common.rs +++ b/rox_compiler/src/common.rs @@ -19,15 +19,15 @@ impl PropertiesOverride{ impl std::fmt::Display for PropertiesOverride{ fn fmt(&self,f:&mut std::fmt::Formatter<'_>)->std::fmt::Result{ if let Some(name)=self.name.as_deref(){ - writeln!(f,"--!Properties.Name = \"{}\"",name)?; + writeln!(f,"-- Properties.Name = \"{}\"",name)?; } if let Some(class)=self.class.as_deref(){ - writeln!(f,"--!Properties.ClassName = \"{}\"",class)?; + writeln!(f,"-- Properties.ClassName = \"{}\"",class)?; } Ok(()) } } pub(crate) fn sanitize<'a>(s:&'a str)->std::borrow::Cow<'a,str>{ - lazy_regex::regex!(r"[^A-z0-9.-]").replace_all(s,"_") + lazy_regex::regex!(r"[^A-Za-z0-9.-]").replace_all(s,"_") } diff --git a/rox_compiler/src/compile.rs b/rox_compiler/src/compile.rs index 81c5b95..8fde920 100644 --- a/rox_compiler/src/compile.rs +++ b/rox_compiler/src/compile.rs @@ -203,7 +203,7 @@ impl ScriptWithOverrides{ let mut count=0; for line in source.lines(){ //only string type properties are supported atm - if let Some(captures)=lazy_regex::regex!(r#"^\-\-\!\s*Properties\.([A-z]\w*)\s*\=\s*"(\w+)"$"#) + if let Some(captures)=lazy_regex::regex!(r#"^\-\-\s*Properties\.([A-Za-z]\w*)\s*\=\s*"(\w+)"$"#) .captures(line){ count+=line.len(); match &captures[1]{