minify-html/rust/onepass/src/unit/instruction.rs

19 lines
511 B
Rust
Raw Normal View History

2020-01-08 07:00:23 -05:00
use crate::err::ProcessingResult;
2020-01-25 02:04:02 -05:00
use crate::proc::MatchAction::*;
use crate::proc::MatchMode::*;
2020-01-25 02:07:52 -05:00
use crate::proc::Processor;
2021-08-08 03:58:10 -04:00
use aho_corasick::AhoCorasick;
use lazy_static::lazy_static;
2020-07-03 06:37:52 -04:00
lazy_static! {
static ref INSTRUCTION_END: AhoCorasick = AhoCorasick::new(&["?>"]);
}
#[inline(always)]
2020-01-08 07:00:23 -05:00
pub fn process_instruction(proc: &mut Processor) -> ProcessingResult<()> {
proc.m(IsSeq(b"<?"), Keep).expect();
2021-08-08 03:58:10 -04:00
proc.m(ThroughSeq(&INSTRUCTION_END), Keep)
.require("instruction end")?;
2020-01-08 07:00:23 -05:00
Ok(())
}