mirror of
https://codeberg.org/icewind/php-literal-parser.git
synced 2026-06-03 18:44:07 +02:00
format
This commit is contained in:
parent
ecbaf4c336
commit
f96b81aa3a
5 changed files with 28 additions and 17 deletions
|
|
@ -297,10 +297,7 @@ impl<'source> ExpectToken<'source> for SpannedToken<'source> {
|
|||
}
|
||||
|
||||
fn map_span(span: &Span) -> SourceSpan {
|
||||
SourceSpan::new(
|
||||
SourceOffset::from(span.start),
|
||||
span.end - span.start,
|
||||
)
|
||||
SourceSpan::new(SourceOffset::from(span.start), span.end - span.start)
|
||||
}
|
||||
|
||||
pub trait ResultExt<T> {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ impl UnescapeState {
|
|||
Some(c) => {
|
||||
self.push_char(c);
|
||||
Ok(())
|
||||
},
|
||||
}
|
||||
None => Err(UnescapeError),
|
||||
}
|
||||
}
|
||||
|
|
@ -205,8 +205,10 @@ impl<'a> PeekableBytes<'a> {
|
|||
|
||||
pub fn is_array_key_numeric(string: &str) -> bool {
|
||||
let mut bytes = string.bytes();
|
||||
if !matches!((bytes.next(), string.len()), (Some(b'-'), _) | (Some(b'0'..=b'9'), 1) | (Some(b'1'..=b'9'), _))
|
||||
{
|
||||
if !matches!(
|
||||
(bytes.next(), string.len()),
|
||||
(Some(b'-'), _) | (Some(b'0'..=b'9'), 1) | (Some(b'1'..=b'9'), _)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue