parse_literal_string

Function parse_literal_string 

Source
pub fn parse_literal_string(
    s: &str,
    quote_char: Option<char>,
    has_quote: bool,
) -> Option<String>
Expand description

Parses a PHP literal string, handling all escape sequences, and returns the result as a String.

§Returns

An Option<String> containing the parsed string or None if the input is invalid.

§Notes

This function is similar to parse_literal_string_in, but it allocates the result on the heap instead of in an arena. It is recommended to use parse_literal_string_in when possible for better performance in contexts where an arena is available.

§Panics

Panics if internal assumptions about character parsing are violated (e.g., invalid hex or octal digits after validation). This should not occur with valid PHP strings.