minify-html/src/unit/comment.rs

19 lines
511 B
Rust
Raw Normal View History

use crate::err::ProcessingResult;
2019-12-29 05:53:49 -05:00
use crate::proc::Processor;
2019-12-25 04:44:51 -05:00
2020-01-01 22:14:40 -05:00
include!(concat!(env!("OUT_DIR"), "/gen_pattern_COMMENT_END.rs"));
pub fn process_comment(proc: &mut Processor) -> ProcessingResult<()> {
2019-12-29 19:33:49 -05:00
if cfg!(debug_assertions) {
chain!(proc.match_seq(b"<!--").expect().discard());
} else {
proc.skip_amount_expect(4);
}
2019-12-25 04:44:51 -05:00
2020-01-01 22:14:40 -05:00
chain!(proc.match_while_not_seq(COMMENT_END).discard());
2019-12-25 04:44:51 -05:00
2020-01-08 07:00:23 -05:00
chain!(proc.match_seq(b"-->").require_with_reason("end of comment")?.discard());
2019-12-25 04:44:51 -05:00
Ok(())
}