MCPcopy Index your code
hub / github.com/aiscriptdev/aiscript / parse_expected_string

Function parse_expected_string

tests/integration.rs:150–162  ·  view source on GitHub ↗
(s: &str)

Source from the content-addressed store, hash-verified

148}
149
150fn parse_expected_string(s: &str) -> String {
151 if s.starts_with("r\"") && s.ends_with('"') {
152 // If it's a raw string (r"..."), treat contents literally
153 s[2..s.len() - 1].to_string()
154 } else if s.starts_with('"') && s.ends_with('"') {
155 // If it's a regular quoted string, unescape its contents
156 let inner = &s[1..s.len() - 1];
157 unescape_string(inner)
158 } else {
159 // If not quoted, treat it as a literal string
160 s.to_string()
161 }
162}
163
164fn unescape_string(s: &str) -> String {
165 let mut result = String::with_capacity(s.len());

Callers 1

parse_commentsFunction · 0.85

Calls 2

unescape_stringFunction · 0.85
lenMethod · 0.80

Tested by

no test coverage detected