trivet 3.1.0

The trivet Parser Library
Documentation
fn main() {
    // Text to parse.  Note that the comment ends on line 5 at column 12, with
    // the first non-comment position at column 13.
    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());
}