Correctly escape strings.

This commit is contained in:
abbie 2024-08-16 16:03:12 +01:00
parent eed358f38f
commit 57b79b8ff4
Signed by: threeoh6000
GPG key ID: 801FE4AD456E922C
3 changed files with 7 additions and 3 deletions

2
Cargo.lock generated
View file

@ -99,7 +99,7 @@ checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0"
[[package]]
name = "granite"
version = "1.0.2"
version = "1.0.3"
dependencies = [
"clap",
]

View file

@ -1,6 +1,6 @@
[package]
name = "granite"
version = "1.0.2"
version = "1.0.3"
edition = "2021"
[dependencies]

View file

@ -330,9 +330,13 @@ fn parse(data: &str) -> Result<Program, String> {
} else {
if char == '\\' {
if !string_escape { string_escape = true; }
else { argument_builder = format!("{}{}", argument_builder, char); }
else {
argument_builder = format!("{}{}", argument_builder, char);
string_escape = false;
}
} else {
argument_builder = format!("{}{}", argument_builder, char);
string_escape = false;
}
}
} else if char == ',' {