Parse string content with escape sequences
(quote_char: char)
| 1722 | |
| 1723 | /// Parse string content with escape sequences |
| 1724 | fn 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 |
| 1746 | fn integer_literal(input: &str) -> IResult<&str, i64> { |