xml5ever/tree_builder/types.rs
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
10use crate::tendril::StrTendril;
11use crate::tokenizer::{Doctype, Pi, Tag};
12
13#[derive(PartialEq, Eq, Copy, Clone, Debug)]
14pub enum XmlPhase {
15 Start,
16 Main,
17 End,
18}
19
20/// A subset/refinement of `tokenizer::Token`. Everything else is handled
21/// specially at the beginning of `process_token`.
22#[derive(PartialEq, Eq, Clone, Debug)]
23pub enum Token {
24 Tag(Tag),
25 Doctype(Doctype),
26 Comment(StrTendril),
27 Characters(StrTendril),
28 Pi(Pi),
29 NullCharacter,
30 Eof,
31}
32
33pub enum XmlProcessResult<Handle> {
34 Done,
35 Reprocess(XmlPhase, Token),
36 Script(Handle),
37}