minify-html/src/unit/comment.rs

14 lines
391 B
Rust
Raw Normal View History

2019-12-25 04:44:51 -05:00
use crate::proc::Processor;
2019-12-25 07:29:18 -05:00
use crate::err::InternalResult;
2019-12-25 04:44:51 -05:00
2019-12-25 07:29:18 -05:00
pub fn process_comment<'d, 'p>(proc: &'p mut Processor<'d>) -> InternalResult<()> {
chain!(proc.match_seq(b"<!--").expect().discard());
2019-12-25 04:44:51 -05:00
// TODO Cannot use this pattern
2019-12-25 07:29:18 -05:00
chain!(proc.match_while_not_seq(b"-->").discard());
2019-12-25 04:44:51 -05:00
2019-12-25 07:29:18 -05:00
chain!(proc.match_seq(b"-->").require_with_reason("comment end")?.discard());
2019-12-25 04:44:51 -05:00
Ok(())
}