MCPcopy Create free account
hub / github.com/dev-formata-io/stof / double_string

Function double_string

src/parser/string.rs:40–50  ·  view source on GitHub ↗

Parse a double quoted string.

(input: &str)

Source from the content-addressed store, hash-verified

38
39/// Parse a double quoted string.
40pub fn double_string(input: &str) -> IResult<&str, String, StofParseError> {
41 let normal = none_of("\"\\"); // everything but backslash or double quote
42 let inner = escaped_transform(normal, '\\', alt((
43 value("\\", tag("\\")),
44 value("\"", tag("\"")),
45 value("\n", tag("n")),
46 value("\r", tag("r")),
47 value("\t", tag("t")),
48 )));
49 delimited(char('"'), map(opt(inner), |opt| opt.unwrap_or_default()), char('"')).parse(input)
50}
51
52/// Parse a single quoted string.
53pub fn single_string(input: &str) -> IResult<&str, String, StofParseError> {

Callers 2

doubleFunction · 0.85
double_escFunction · 0.85

Calls 2

valueFunction · 0.70
parseMethod · 0.45

Tested by 2

doubleFunction · 0.68
double_escFunction · 0.68