forked from StrafesNET/asset-tool
fix regex and remove --! because luau doesn't like it
This commit is contained in:
parent
cb984a9f20
commit
c947691f75
@ -19,15 +19,15 @@ impl PropertiesOverride{
|
|||||||
impl std::fmt::Display for PropertiesOverride{
|
impl std::fmt::Display for PropertiesOverride{
|
||||||
fn fmt(&self,f:&mut std::fmt::Formatter<'_>)->std::fmt::Result{
|
fn fmt(&self,f:&mut std::fmt::Formatter<'_>)->std::fmt::Result{
|
||||||
if let Some(name)=self.name.as_deref(){
|
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(){
|
if let Some(class)=self.class.as_deref(){
|
||||||
writeln!(f,"--!Properties.ClassName = \"{}\"",class)?;
|
writeln!(f,"-- Properties.ClassName = \"{}\"",class)?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn sanitize<'a>(s:&'a str)->std::borrow::Cow<'a,str>{
|
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,"_")
|
||||||
}
|
}
|
||||||
|
@ -203,7 +203,7 @@ impl ScriptWithOverrides{
|
|||||||
let mut count=0;
|
let mut count=0;
|
||||||
for line in source.lines(){
|
for line in source.lines(){
|
||||||
//only string type properties are supported atm
|
//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){
|
.captures(line){
|
||||||
count+=line.len();
|
count+=line.len();
|
||||||
match &captures[1]{
|
match &captures[1]{
|
||||||
|
Loading…
Reference in New Issue
Block a user