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
15pub use self::AttrValueKind::*;
16pub use self::DoctypeIdKind::*;
17pub use self::RawKind::*;
18pub use self::ScriptEscapeKind::*;
19pub use self::State::*;
20
21#[derive(PartialEq, Eq, PartialOrd, Ord, Copy, Clone, Hash, Debug)]
22pub enum ScriptEscapeKind {
23 Escaped,
24 DoubleEscaped,
25}
26
27#[derive(PartialEq, Eq, PartialOrd, Ord, Copy, Clone, Hash, Debug)]
28pub enum DoctypeIdKind {
29 Public,
30 System,
31}
32
33#[derive(PartialEq, Eq, PartialOrd, Ord, Copy, Clone, Hash, Debug)]
34pub enum RawKind {
35 Rcdata,
36 Rawtext,
37 ScriptData,
38 ScriptDataEscaped(ScriptEscapeKind),
39}
40
41#[derive(PartialEq, Eq, PartialOrd, Ord, Copy, Clone, Hash, Debug)]
42pub enum AttrValueKind {
43 Unquoted,
44 SingleQuoted,
45 DoubleQuoted,
46}
47
48#[derive(PartialEq, Eq, PartialOrd, Ord, Copy, Clone, Hash, Debug)]
49pub 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 CommentLessThanSign,
77 CommentLessThanSignBang,
78 CommentLessThanSignBangDash,
79 CommentLessThanSignBangDashDash,
80 CommentEndDash,
81 CommentEnd,
82 CommentEndBang,
83 Doctype,
84 BeforeDoctypeName,
85 DoctypeName,
86 AfterDoctypeName,
87 AfterDoctypeKeyword(DoctypeIdKind),
88 BeforeDoctypeIdentifier(DoctypeIdKind),
89 DoctypeIdentifierDoubleQuoted(DoctypeIdKind),
90 DoctypeIdentifierSingleQuoted(DoctypeIdKind),
91 AfterDoctypeIdentifier(DoctypeIdKind),
92 BetweenDoctypePublicAndSystemIdentifiers,
93 BogusDoctype,
94 CdataSection,
95 CdataSectionBracket,
96 CdataSectionEnd,
97}
98