]> git.proxmox.com Git - rustc.git/blob - src/vendor/html5ever/src/tree_builder/types.rs
New upstream version 1.22.1+dfsg1
[rustc.git] / src / vendor / html5ever / src / 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
10 //! Types used within the tree builder code. Not exported to users.
11
12 use tokenizer::Tag;
13 use tokenizer::states::RawKind;
14
15 use tendril::StrTendril;
16
17 pub use self::InsertionMode::*;
18 pub use self::SplitStatus::*;
19 pub use self::Token::*;
20 pub use self::ProcessResult::*;
21 pub use self::FormatEntry::*;
22 pub use self::InsertionPoint::*;
23
24 #[derive(PartialEq, Eq, Copy, Clone, Debug)]
25 pub enum InsertionMode {
26 Initial,
27 BeforeHtml,
28 BeforeHead,
29 InHead,
30 InHeadNoscript,
31 AfterHead,
32 InBody,
33 Text,
34 InTable,
35 InTableText,
36 InCaption,
37 InColumnGroup,
38 InTableBody,
39 InRow,
40 InCell,
41 InSelect,
42 InSelectInTable,
43 InTemplate,
44 AfterBody,
45 InFrameset,
46 AfterFrameset,
47 AfterAfterBody,
48 AfterAfterFrameset,
49 }
50
51 #[derive(PartialEq, Eq, Copy, Clone, Debug)]
52 pub enum SplitStatus {
53 NotSplit,
54 Whitespace,
55 NotWhitespace,
56 }
57
58 /// A subset/refinement of `tokenizer::Token`. Everything else is handled
59 /// specially at the beginning of `process_token`.
60 #[derive(PartialEq, Eq, Clone, Debug)]
61 pub enum Token {
62 TagToken(Tag),
63 CommentToken(StrTendril),
64 CharacterTokens(SplitStatus, StrTendril),
65 NullCharacterToken,
66 EOFToken,
67 }
68
69 pub enum ProcessResult<Handle> {
70 Done,
71 DoneAckSelfClosing,
72 SplitWhitespace(StrTendril),
73 Reprocess(InsertionMode, Token),
74 ReprocessForeign(Token),
75 Script(Handle),
76 ToPlaintext,
77 ToRawData(RawKind),
78 }
79
80 pub enum FormatEntry<Handle> {
81 Element(Handle, Tag),
82 Marker,
83 }
84
85 pub enum InsertionPoint<Handle> {
86 /// Insert as last child in this parent.
87 LastChild(Handle),
88 /// Insert before this following sibling.
89 BeforeSibling(Handle)
90 }