MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / escaped_string_content

Function escaped_string_content

graphlite/src/ast/lexer.rs:1724–1743  ·  view source on GitHub ↗

Parse string content with escape sequences

(quote_char: char)

Source from the content-addressed store, hash-verified

1722
1723/// Parse string content with escape sequences
1724fn escaped_string_content(quote_char: char) -> impl Fn(&str) -> IResult<&str, &str> {
1725 move |input: &str| {
1726 let mut pos = 0;
1727 let input_bytes = input.as_bytes();
1728
1729 while pos < input_bytes.len() {
1730 if input_bytes[pos] == b'\\' && pos + 1 < input_bytes.len() {
1731 // Skip escaped character (including escaped quotes)
1732 pos += 2;
1733 } else if input_bytes[pos] == quote_char as u8 {
1734 // Found unescaped quote - end of string content
1735 break;
1736 } else {
1737 pos += 1;
1738 }
1739 }
1740
1741 Ok((&input[pos..], &input[0..pos]))
1742 }
1743}
1744
1745/// Parse integer literals
1746fn integer_literal(input: &str) -> IResult<&str, i64> {

Callers 1

string_literalFunction · 0.85

Calls 1

lenMethod · 0.45

Tested by

no test coverage detected