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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 } | 197 } |
198 | 198 |
199 private: | 199 private: |
200 explicit HTMLTokenizer(const HTMLParserOptions&); | 200 explicit HTMLTokenizer(const HTMLParserOptions&); |
201 | 201 |
202 inline bool processEntity(SegmentedString&); | 202 inline bool processEntity(SegmentedString&); |
203 | 203 |
204 inline void parseError(); | 204 inline void parseError(); |
205 | 205 |
206 inline void bufferCharacter(UChar character) { | 206 inline void bufferCharacter(UChar character) { |
207 ASSERT(character != kEndOfFileMarker); | 207 DCHECK_NE(character, kEndOfFileMarker); |
208 m_token->ensureIsCharacterToken(); | 208 m_token->ensureIsCharacterToken(); |
209 m_token->appendToCharacter(character); | 209 m_token->appendToCharacter(character); |
210 } | 210 } |
211 | 211 |
212 inline bool emitAndResumeIn(SegmentedString& source, State state) { | 212 inline bool emitAndResumeIn(SegmentedString& source, State state) { |
213 saveEndTagNameIfNeeded(); | 213 saveEndTagNameIfNeeded(); |
214 m_state = state; | 214 m_state = state; |
215 source.advanceAndUpdateLineNumber(); | 215 source.advanceAndUpdateLineNumber(); |
216 return true; | 216 return true; |
217 } | 217 } |
(...skipping 20 matching lines...) Expand all Loading... |
238 // the buffered end tag. | 238 // the buffered end tag. |
239 inline bool flushBufferedEndTag(SegmentedString&); | 239 inline bool flushBufferedEndTag(SegmentedString&); |
240 inline bool temporaryBufferIs(const String&); | 240 inline bool temporaryBufferIs(const String&); |
241 | 241 |
242 // Sometimes we speculatively consume input characters and we don't | 242 // Sometimes we speculatively consume input characters and we don't |
243 // know whether they represent end tags or RCDATA, etc. These | 243 // know whether they represent end tags or RCDATA, etc. These |
244 // functions help manage these state. | 244 // functions help manage these state. |
245 inline void addToPossibleEndTag(LChar cc); | 245 inline void addToPossibleEndTag(LChar cc); |
246 | 246 |
247 inline void saveEndTagNameIfNeeded() { | 247 inline void saveEndTagNameIfNeeded() { |
248 ASSERT(m_token->type() != HTMLToken::Uninitialized); | 248 DCHECK_NE(m_token->type(), HTMLToken::Uninitialized); |
249 if (m_token->type() == HTMLToken::StartTag) | 249 if (m_token->type() == HTMLToken::StartTag) |
250 m_appropriateEndTagName = m_token->name(); | 250 m_appropriateEndTagName = m_token->name(); |
251 } | 251 } |
252 inline bool isAppropriateEndTag(); | 252 inline bool isAppropriateEndTag(); |
253 | 253 |
254 inline bool haveBufferedCharacterToken() { | 254 inline bool haveBufferedCharacterToken() { |
255 return m_token->type() == HTMLToken::Character; | 255 return m_token->type() == HTMLToken::Character; |
256 } | 256 } |
257 | 257 |
258 State m_state; | 258 State m_state; |
(...skipping 19 matching lines...) Expand all Loading... |
278 // token (e.g., when lexing script). We buffer the name of the end tag | 278 // token (e.g., when lexing script). We buffer the name of the end tag |
279 // token here so we remember it next time we re-enter the tokenizer. | 279 // token here so we remember it next time we re-enter the tokenizer. |
280 Vector<LChar, 32> m_bufferedEndTagName; | 280 Vector<LChar, 32> m_bufferedEndTagName; |
281 | 281 |
282 HTMLParserOptions m_options; | 282 HTMLParserOptions m_options; |
283 }; | 283 }; |
284 | 284 |
285 } // namespace blink | 285 } // namespace blink |
286 | 286 |
287 #endif | 287 #endif |
OLD | NEW |