OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * Copyright (C) 2010 Google, Inc. All Rights Reserved. | 3 * Copyright (C) 2010 Google, Inc. All Rights Reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 ~HTMLTokenizer(); | 42 ~HTMLTokenizer(); |
43 | 43 |
44 void reset(); | 44 void reset(); |
45 | 45 |
46 enum State { | 46 enum State { |
47 DataState, | 47 DataState, |
48 CharacterReferenceInDataState, | 48 CharacterReferenceInDataState, |
49 CharacterReferenceInAttributeValueState, | 49 CharacterReferenceInAttributeValueState, |
50 RAWTEXTState, | 50 RAWTEXTState, |
51 TagOpenState, | 51 TagOpenState, |
52 EndTagOpenState, | 52 CloseTagState, |
53 TagNameState, | 53 TagNameState, |
54 RAWTEXTLessThanSignState, | 54 RAWTEXTLessThanSignState, |
55 RAWTEXTEndTagOpenState, | 55 RAWTEXTEndTagOpenState, |
56 RAWTEXTEndTagNameState, | 56 RAWTEXTEndTagNameState, |
57 BeforeAttributeNameState, | 57 BeforeAttributeNameState, |
58 AttributeNameState, | 58 AttributeNameState, |
59 AfterAttributeNameState, | 59 AfterAttributeNameState, |
60 BeforeAttributeValueState, | 60 BeforeAttributeValueState, |
61 AttributeValueDoubleQuotedState, | 61 AttributeValueDoubleQuotedState, |
62 AttributeValueSingleQuotedState, | 62 AttributeValueSingleQuotedState, |
63 AttributeValueUnquotedState, | 63 AttributeValueUnquotedState, |
64 AfterAttributeValueQuotedState, | 64 AfterAttributeValueQuotedState, |
65 SelfClosingStartTagState, | 65 SelfClosingStartTagState, |
66 BogusCommentState, | 66 CommentStart1State, |
67 // The ContinueBogusCommentState is not in the HTML5 spec, but we use | 67 CommentStart2State, |
68 // it internally to keep track of whether we've started the bogus | |
69 // comment token yet. | |
70 ContinueBogusCommentState, | |
71 MarkupDeclarationOpenState, | |
72 CommentStartState, | |
73 CommentStartDashState, | |
74 CommentState, | 68 CommentState, |
75 CommentEndDashState, | 69 CommentEnd1State, |
76 CommentEndState, | 70 CommentEnd2State, |
77 CommentEndBangState, | |
78 }; | 71 }; |
79 | 72 |
80 // This function returns true if it emits a token. Otherwise, callers | 73 // This function returns true if it emits a token. Otherwise, callers |
81 // must provide the same (in progress) token on the next call (unless | 74 // must provide the same (in progress) token on the next call (unless |
82 // they call reset() first). | 75 // they call reset() first). |
83 bool nextToken(SegmentedString&, HTMLToken&); | 76 bool nextToken(SegmentedString&, HTMLToken&); |
84 | 77 |
85 State state() const { return m_state; } | 78 State state() const { return m_state; } |
86 void setState(State state) { m_state = state; } | 79 void setState(State state) { m_state = state; } |
87 | 80 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 161 |
169 // We occationally want to emit both a character token and an end tag | 162 // We occationally want to emit both a character token and an end tag |
170 // token (e.g., when lexing script). We buffer the name of the end tag | 163 // token (e.g., when lexing script). We buffer the name of the end tag |
171 // token here so we remember it next time we re-enter the tokenizer. | 164 // token here so we remember it next time we re-enter the tokenizer. |
172 Vector<LChar, 32> m_bufferedEndTagName; | 165 Vector<LChar, 32> m_bufferedEndTagName; |
173 }; | 166 }; |
174 | 167 |
175 } | 168 } |
176 | 169 |
177 #endif | 170 #endif |
OLD | NEW |