mirror of
https://codeberg.org/icewind/php-literal-parser.git
synced 2026-06-03 10:34:08 +02:00
fix string un-escaping
This commit is contained in:
parent
836d593997
commit
199aefdda7
1 changed files with 4 additions and 2 deletions
|
|
@ -76,7 +76,8 @@ struct SingleQuoteString;
|
||||||
impl EscapedString for SingleQuoteString {
|
impl EscapedString for SingleQuoteString {
|
||||||
fn handle_escape<'a>(bytes: &'a [u8], state: &mut UnescapeState) -> UnescapeResult<&'a [u8]> {
|
fn handle_escape<'a>(bytes: &'a [u8], state: &mut UnescapeState) -> UnescapeResult<&'a [u8]> {
|
||||||
let mut ins = PeekableBytes::new(bytes);
|
let mut ins = PeekableBytes::new(bytes);
|
||||||
debug_assert_eq!(ins.next(), Some(b'\\'));
|
let _next = ins.next();
|
||||||
|
debug_assert_eq!(_next, Some(b'\\'));
|
||||||
match ins.next() {
|
match ins.next() {
|
||||||
None => {
|
None => {
|
||||||
return Err(UnescapeError);
|
return Err(UnescapeError);
|
||||||
|
|
@ -98,7 +99,8 @@ struct DoubleQuoteString;
|
||||||
impl EscapedString for DoubleQuoteString {
|
impl EscapedString for DoubleQuoteString {
|
||||||
fn handle_escape<'a>(bytes: &'a [u8], state: &mut UnescapeState) -> UnescapeResult<&'a [u8]> {
|
fn handle_escape<'a>(bytes: &'a [u8], state: &mut UnescapeState) -> UnescapeResult<&'a [u8]> {
|
||||||
let mut ins = PeekableBytes::new(bytes);
|
let mut ins = PeekableBytes::new(bytes);
|
||||||
debug_assert_eq!(ins.next(), Some(b'\\'));
|
let _next = ins.next();
|
||||||
|
debug_assert_eq!(_next, Some(b'\\'));
|
||||||
match ins.next() {
|
match ins.next() {
|
||||||
None => {
|
None => {
|
||||||
return Err(UnescapeError);
|
return Err(UnescapeError);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue