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 //! Tokenizer states.
11 //!
12 //! This is public for use by the tokenizer tests.  Other library
13 //! users should not have to care about this.
14 
15 pub use self::AttrValueKind::*;
16 pub use self::DoctypeIdKind::*;
17 pub use self::RawKind::*;
18 pub use self::ScriptEscapeKind::*;
19 pub use self::State::*;
20 
21 #[derive(PartialEq, Eq, PartialOrd, Ord, Copy, Clone, Hash, Debug)]
22 pub enum ScriptEscapeKind {
23     Escaped,
24     DoubleEscaped,
25 }
26 
27 #[derive(PartialEq, Eq, PartialOrd, Ord, Copy, Clone, Hash, Debug)]
28 pub enum DoctypeIdKind {
29     Public,
30     System,
31 }
32 
33 #[derive(PartialEq, Eq, PartialOrd, Ord, Copy, Clone, Hash, Debug)]
34 pub enum RawKind {
35     Rcdata,
36     Rawtext,
37     ScriptData,
38     ScriptDataEscaped(ScriptEscapeKind),
39 }
40 
41 #[derive(PartialEq, Eq, PartialOrd, Ord, Copy, Clone, Hash, Debug)]
42 pub enum AttrValueKind {
43     Unquoted,
44     SingleQuoted,
45     DoubleQuoted,
46 }
47 
48 #[derive(PartialEq, Eq, PartialOrd, Ord, Copy, Clone, Hash, Debug)]
49 pub enum State {
50     Data,
51     Plaintext,
52     TagOpen,
53     EndTagOpen,
54     TagName,
55     RawData(RawKind),
56     RawLessThanSign(RawKind),
57     RawEndTagOpen(RawKind),
58     RawEndTagName(RawKind),
59     ScriptDataEscapeStart(ScriptEscapeKind),
60     ScriptDataEscapeStartDash,
61     ScriptDataEscapedDash(ScriptEscapeKind),
62     ScriptDataEscapedDashDash(ScriptEscapeKind),
63     ScriptDataDoubleEscapeEnd,
64     BeforeAttributeName,
65     AttributeName,
66     AfterAttributeName,
67     BeforeAttributeValue,
68     AttributeValue(AttrValueKind),
69     AfterAttributeValueQuoted,
70     SelfClosingStartTag,
71     BogusComment,
72     MarkupDeclarationOpen,
73     CommentStart,
74     CommentStartDash,
75     Comment,
76     CommentEndDash,
77     CommentEnd,
78     CommentEndBang,
79     Doctype,
80     BeforeDoctypeName,
81     DoctypeName,
82     AfterDoctypeName,
83     AfterDoctypeKeyword(DoctypeIdKind),
84     BeforeDoctypeIdentifier(DoctypeIdKind),
85     DoctypeIdentifierDoubleQuoted(DoctypeIdKind),
86     DoctypeIdentifierSingleQuoted(DoctypeIdKind),
87     AfterDoctypeIdentifier(DoctypeIdKind),
88     BetweenDoctypePublicAndSystemIdentifiers,
89     BogusDoctype,
90     CdataSection,
91     CdataSectionBracket,
92     CdataSectionEnd,
93 }
94