fix regex and remove --! because luau doesn't like it

This commit is contained in:
Quaternions 2024-07-04 13:32:00 -07:00
parent cb984a9f20
commit c947691f75
2 changed files with 4 additions and 4 deletions

View File

@ -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,"_")
}

View File

@ -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]{