#![warn(clippy::pedantic)]
#![allow(clippy::module_name_repetitions)]
pub use parser::parse;
pub use parser::Parse;
pub use parser::ParseError;
use crate::lexer::lex;
mod grammar;
mod lexer;
mod parser;
pub mod syntax;
pub use grammar::TWIG_NAME_REGEX;
#[cfg(test)]
mod tests {
use super::*;
use crate::syntax::typed::AstNode;
use crate::syntax::typed::HtmlTag;
use crate::syntax::untyped::SyntaxNode;
use rowan::ast::support;
#[test]
fn it_should_not_panic_on_simple_parse_call() {
let _ = parse("asdf");
}
#[test]
fn it_should_not_panic_on_prev_sibling_call() {
let parse = parse("<div>a<hr/></div>");
let root = SyntaxNode::new_root(parse.green_node);
let prev = root.prev_sibling();
assert!(prev.is_none());
let child: HtmlTag = support::child(&root).unwrap();
let prev = child.syntax().prev_sibling();
assert!(prev.is_none());
let child: HtmlTag = support::child(child.body().unwrap().syntax()).unwrap();
let prev = child.syntax().prev_sibling();
assert!(prev.is_some());
}
}