You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"Unescaped trailing '{' in format string. Escape '{' with '{{'".into(),
780
+
&node,
781
+
);
782
+
break;
783
+
}
784
+
p += pos;
785
+
786
+
// Skip escaped }
787
+
if string.get(p..=p) == Some("}"){
788
+
if string.get(p + 1..=p + 1) == Some("}"){
789
+
pos = p + 2;
790
+
continue;
791
+
}else{
792
+
ctx.diag.push_error(
793
+
"Unescaped '}' in format string. Escape '}' with '}}'".into(),
794
+
&node,
795
+
);
796
+
break;
797
+
}
798
+
}
799
+
800
+
// Skip escaped {
801
+
if string.get(p + 1..=p + 1) == Some("{"){
802
+
pos = p + 2;
803
+
continue;
804
+
}
805
+
806
+
// Find the argument
807
+
let end = ifletSome(end) = string[p..].find('}'){
808
+
end + p
809
+
}else{
810
+
ctx.diag.push_error(
811
+
"Unterminated placeholder in format string. '{' must be escaped with '{{'"
812
+
.into(),
813
+
&node,
814
+
);
815
+
break;
816
+
};
817
+
let argument = &string[p + 1..end];
818
+
if argument.is_empty(){
819
+
arg_idx += 1;
820
+
}elseifletOk(n) = argument.parse::<u16>(){
821
+
pos_max = pos_max.max(n asusize + 1);
822
+
}else{
823
+
ctx.diag
824
+
.push_error("Invalid '{...}' placeholder in format string. The placeholder must be a number, or braces must be escaped with '{{' and '}}'".into(),&node);
0 commit comments