diff options
| author | Martin Fischer <martin@push-f.com> | 2023-08-18 14:14:52 +0200 | 
|---|---|---|
| committer | Martin Fischer <martin@push-f.com> | 2023-08-19 06:41:03 +0200 | 
| commit | bfff0560a0e448eef41ac2b4c7e8deb0a77e4167 (patch) | |
| tree | bc9c3e5665aeedd3676bee2ee2a0133bf840bea2 /examples | |
| parent | 9892c726fb212a1af36737d5741ff8421ff20829 (diff) | |
break!: remove StartTag::next_state
You shouldn't manually have to match tokens yielded by the
tokenizer iterator just to correctly handle state transitions.
A better NaiveParser API will be introduced.
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/switch-state.rs | 20 | 
1 files changed, 0 insertions, 20 deletions
| diff --git a/examples/switch-state.rs b/examples/switch-state.rs deleted file mode 100644 index 9ebc673..0000000 --- a/examples/switch-state.rs +++ /dev/null @@ -1,20 +0,0 @@ -//! Let's you easily try out the tokenizer with e.g. -//! printf '<style><b>Hello world!</b></style>' | cargo run --example=switch-state -use html5tokenizer::{BufReadReader, Token, Tokenizer}; -use std::io::stdin; - -fn main() { -    let stdin = stdin(); -    let mut tokenizer = Tokenizer::new(BufReadReader::new(stdin.lock())); - -    while let Some(token) = tokenizer.next() { -        let token = token.unwrap(); -        println!("{:?}", token); - -        if let Token::StartTag(start_tag) = token { -            // take care of switching parser state for e.g. <script> & <style> -            // this is not strictly spec-compliant but good enough most of the time -            tokenizer.set_state(start_tag.next_state(false)); -        } -    } -} | 
