fn main() {
let mut parser = trivet::parse_from_string(
r#"
--[[
I am a long form
Lua comment.
--]]"#,
);
parser.borrow_comment_parser().enable_c = false;
parser.borrow_comment_parser().enable_cpp = false;
parser.borrow_comment_parser().custom = Box::new(|parser: &mut trivet::ParserCore| -> bool {
if parser.peek_and_consume_chars(&['-', '-', '[', '[']) {
parser.take_until("--]]");
true
} else if parser.peek_and_consume_chars(&['-', '-']) {
parser.take_while(|ch| ch != '\n');
true
} else {
false
}
});
parser.borrow_comment_parser().enable_custom = true;
parser.consume_ws();
assert_eq!(parser.loc().to_string(), "<string>:5:13");
assert!(parser.is_at_eof());
}