minify-html/src/unit/comment.rs

17 lines
462 B
Rust
Raw Normal View History

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;
2020-07-03 06:37:52 -04:00
pub fn process_comment(proc: &mut Processor) -> ProcessingResult<()> {
proc.m(IsSeq(b"<!--"), Discard).expect();
2020-07-11 08:52:27 -04:00
loop {
// Use fast memchr.
let possible = proc.m(ThroughChar(b'>'), Discard).require("comment end")?;
if proc[possible].ends_with(b"-->") {
break;
};
};
2019-12-25 04:44:51 -05:00
Ok(())
}