1 // Copyright 2014-2017 The html5ever Project Developers. See the
2 // COPYRIGHT file at the top-level directory of this distribution.
3 //
4 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7 // option. This file may not be copied, modified, or distributed
8 // except according to those terms.
9 
10 pub use self::Token::*;
11 pub use self::XmlPhase::*;
12 pub use self::XmlProcessResult::*;
13 
14 use crate::tendril::StrTendril;
15 use crate::tokenizer::{Doctype, Pi, Tag};
16 
17 #[derive(PartialEq, Eq, Copy, Clone, Debug)]
18 pub enum XmlPhase {
19     StartPhase,
20     MainPhase,
21     EndPhase,
22 }
23 
24 /// A subset/refinement of `tokenizer::XToken`.  Everything else is handled
25 /// specially at the beginning of `process_token`.
26 #[derive(PartialEq, Eq, Clone, Debug)]
27 pub enum Token {
28     TagToken(Tag),
29     DoctypeToken(Doctype),
30     CommentToken(StrTendril),
31     CharacterTokens(StrTendril),
32     PIToken(Pi),
33     NullCharacterToken,
34     EOFToken,
35 }
36 
37 pub enum XmlProcessResult {
38     Done,
39     Reprocess(XmlPhase, Token),
40 }
41