//! Let's you easily try out the tokenizer with e.g.
//! printf '
Hello world!
' | cargo run --example=tokenize
use html5tokenizer::{BasicEmitter, Event, Tokenizer};
use std::io::BufReader;
fn main() {
let mut tokenizer = Tokenizer::new(
BufReader::new(std::io::stdin().lock()),
BasicEmitter::default(),
);
while let Some(token) = tokenizer.next() {
for (error, _) in tokenizer.emitter_mut().drain_errors() {
eprintln!("error: {:?}", error);
}
let token = token.unwrap();
match token {
Event::CdataOpen => println!("CDATA open"),
Event::Token(token) => println!("{token:?}"),
}
}
}