Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/proc-macros/pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

use std::{cmp, fmt, mem, str};

#[cfg(feature = "std")]

Check warning on line 45 in src/proc-macros/pattern.rs

View workflow job for this annotation

GitHub Actions / ci-linux (nightly)

unexpected `cfg` condition value: `std`

Check warning on line 45 in src/proc-macros/pattern.rs

View workflow job for this annotation

GitHub Actions / ci-linux (beta)

unexpected `cfg` condition value: `std`

Check warning on line 45 in src/proc-macros/pattern.rs

View workflow job for this annotation

GitHub Actions / ci-linux (nightly)

unexpected `cfg` condition value: `std`

Check warning on line 45 in src/proc-macros/pattern.rs

View workflow job for this annotation

GitHub Actions / ci-linux (beta)

unexpected `cfg` condition value: `std`

Check warning on line 45 in src/proc-macros/pattern.rs

View workflow job for this annotation

GitHub Actions / ci-linux (stable)

unexpected `cfg` condition value: `std`

Check warning on line 45 in src/proc-macros/pattern.rs

View workflow job for this annotation

GitHub Actions / ci-linux (stable)

unexpected `cfg` condition value: `std`

Check warning on line 45 in src/proc-macros/pattern.rs

View workflow job for this annotation

GitHub Actions / ci-windows (beta, x86_64-pc-windows-msvc)

unexpected `cfg` condition value: `std`

Check warning on line 45 in src/proc-macros/pattern.rs

View workflow job for this annotation

GitHub Actions / ci-windows (beta, x86_64-pc-windows-msvc)

unexpected `cfg` condition value: `std`

Check warning on line 45 in src/proc-macros/pattern.rs

View workflow job for this annotation

GitHub Actions / ci-windows (nightly, x86_64-pc-windows-msvc)

unexpected `cfg` condition value: `std`

Check warning on line 45 in src/proc-macros/pattern.rs

View workflow job for this annotation

GitHub Actions / ci-windows (nightly, x86_64-pc-windows-msvc)

unexpected `cfg` condition value: `std`

Check warning on line 45 in src/proc-macros/pattern.rs

View workflow job for this annotation

GitHub Actions / ci-windows (stable, x86_64-pc-windows-msvc)

unexpected `cfg` condition value: `std`

Check warning on line 45 in src/proc-macros/pattern.rs

View workflow job for this annotation

GitHub Actions / ci-windows (stable, x86_64-pc-windows-msvc)

unexpected `cfg` condition value: `std`

Check warning on line 45 in src/proc-macros/pattern.rs

View workflow job for this annotation

GitHub Actions / ci-windows (beta, i686-pc-windows-msvc)

unexpected `cfg` condition value: `std`

Check warning on line 45 in src/proc-macros/pattern.rs

View workflow job for this annotation

GitHub Actions / ci-windows (beta, i686-pc-windows-msvc)

unexpected `cfg` condition value: `std`

Check warning on line 45 in src/proc-macros/pattern.rs

View workflow job for this annotation

GitHub Actions / ci-windows (stable, i686-pc-windows-msvc)

unexpected `cfg` condition value: `std`

Check warning on line 45 in src/proc-macros/pattern.rs

View workflow job for this annotation

GitHub Actions / ci-windows (stable, i686-pc-windows-msvc)

unexpected `cfg` condition value: `std`

Check warning on line 45 in src/proc-macros/pattern.rs

View workflow job for this annotation

GitHub Actions / ci-windows (nightly, i686-pc-windows-msvc)

unexpected `cfg` condition value: `std`

Check warning on line 45 in src/proc-macros/pattern.rs

View workflow job for this annotation

GitHub Actions / ci-windows (nightly, i686-pc-windows-msvc)

unexpected `cfg` condition value: `std`
use std::error;

/// Max recursion depth.
Expand All @@ -63,7 +63,7 @@
write!(f, "Syntax Error @{}: {}.", self.position, self.kind.to_str())
}
}
#[cfg(feature = "std")]

Check warning on line 66 in src/proc-macros/pattern.rs

View workflow job for this annotation

GitHub Actions / ci-linux (nightly)

unexpected `cfg` condition value: `std`

Check warning on line 66 in src/proc-macros/pattern.rs

View workflow job for this annotation

GitHub Actions / ci-linux (beta)

unexpected `cfg` condition value: `std`

Check warning on line 66 in src/proc-macros/pattern.rs

View workflow job for this annotation

GitHub Actions / ci-linux (nightly)

unexpected `cfg` condition value: `std`

Check warning on line 66 in src/proc-macros/pattern.rs

View workflow job for this annotation

GitHub Actions / ci-linux (beta)

unexpected `cfg` condition value: `std`

Check warning on line 66 in src/proc-macros/pattern.rs

View workflow job for this annotation

GitHub Actions / ci-linux (stable)

unexpected `cfg` condition value: `std`

Check warning on line 66 in src/proc-macros/pattern.rs

View workflow job for this annotation

GitHub Actions / ci-linux (stable)

unexpected `cfg` condition value: `std`

Check warning on line 66 in src/proc-macros/pattern.rs

View workflow job for this annotation

GitHub Actions / ci-windows (beta, x86_64-pc-windows-msvc)

unexpected `cfg` condition value: `std`

Check warning on line 66 in src/proc-macros/pattern.rs

View workflow job for this annotation

GitHub Actions / ci-windows (beta, x86_64-pc-windows-msvc)

unexpected `cfg` condition value: `std`

Check warning on line 66 in src/proc-macros/pattern.rs

View workflow job for this annotation

GitHub Actions / ci-windows (nightly, x86_64-pc-windows-msvc)

unexpected `cfg` condition value: `std`

Check warning on line 66 in src/proc-macros/pattern.rs

View workflow job for this annotation

GitHub Actions / ci-windows (nightly, x86_64-pc-windows-msvc)

unexpected `cfg` condition value: `std`

Check warning on line 66 in src/proc-macros/pattern.rs

View workflow job for this annotation

GitHub Actions / ci-windows (stable, x86_64-pc-windows-msvc)

unexpected `cfg` condition value: `std`

Check warning on line 66 in src/proc-macros/pattern.rs

View workflow job for this annotation

GitHub Actions / ci-windows (stable, x86_64-pc-windows-msvc)

unexpected `cfg` condition value: `std`

Check warning on line 66 in src/proc-macros/pattern.rs

View workflow job for this annotation

GitHub Actions / ci-windows (beta, i686-pc-windows-msvc)

unexpected `cfg` condition value: `std`

Check warning on line 66 in src/proc-macros/pattern.rs

View workflow job for this annotation

GitHub Actions / ci-windows (beta, i686-pc-windows-msvc)

unexpected `cfg` condition value: `std`

Check warning on line 66 in src/proc-macros/pattern.rs

View workflow job for this annotation

GitHub Actions / ci-windows (stable, i686-pc-windows-msvc)

unexpected `cfg` condition value: `std`

Check warning on line 66 in src/proc-macros/pattern.rs

View workflow job for this annotation

GitHub Actions / ci-windows (stable, i686-pc-windows-msvc)

unexpected `cfg` condition value: `std`

Check warning on line 66 in src/proc-macros/pattern.rs

View workflow job for this annotation

GitHub Actions / ci-windows (nightly, i686-pc-windows-msvc)

unexpected `cfg` condition value: `std`

Check warning on line 66 in src/proc-macros/pattern.rs

View workflow job for this annotation

GitHub Actions / ci-windows (nightly, i686-pc-windows-msvc)

unexpected `cfg` condition value: `std`
impl error::Error for ParsePatError {
fn description(&self) -> &str {
self.kind.to_str()
Expand Down Expand Up @@ -493,12 +493,16 @@
// Match raw bytes
b'"' => loop {
if let Some(chr) = iter.next().cloned() {
if chr != b'"' {
result.push(Atom::Byte(chr));
}
else {
if chr == b'"' {
// Handle escaped quotes `""`
if iter.as_slice().first() == Some(&b'"') {
iter.next();
result.push(Atom::Byte(b'"'));
continue;
}
break;
}
result.push(Atom::Byte(chr));
}
else {
return Err(PatError::UnclosedQuote);
Expand Down Expand Up @@ -641,6 +645,12 @@
Save(0), Byte(115), Byte(116), Byte(114), Byte(105), Byte(110), Byte(103)
]));

assert_eq!(parse("\"string\"\"quote\"\"string\""), Ok(vec![
Save(0), Byte(115), Byte(116), Byte(114), Byte(105), Byte(110), Byte(103),
Byte(34), Byte(113), Byte(117), Byte(111), Byte(116), Byte(101), Byte(34),
Byte(115), Byte(116), Byte(114), Byte(105), Byte(110), Byte(103)
]));

assert_eq!(parse("*{FF D8 42}"), Ok(vec![
Save(0), Push(PTR_SKIP), Ptr, Byte(0xFF), Byte(0xD8), Byte(0x42)
]));
Expand Down
Loading