Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(591)

Side by Side Diff: third_party/WebKit/Source/core/xml/parser/MarkupTokenizerInlines.h

Issue 2724593002: Move MarkupTokenizerInlines.h to core/html (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/xml/BUILD.gn ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2009 Torch Mobile, Inc. http://www.torchmobile.com/
4 * Copyright (C) 2010 Google, Inc. All Rights Reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
16 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
19 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28 #ifndef MarkupTokenizerInlines_h
29 #define MarkupTokenizerInlines_h
30
31 #include "platform/text/SegmentedString.h"
32
33 namespace blink {
34
35 inline bool isTokenizerWhitespace(UChar cc) {
36 return cc == ' ' || cc == '\x0A' || cc == '\x09' || cc == '\x0C';
37 }
38
39 inline void advanceStringAndASSERTIgnoringCase(SegmentedString& source,
40 const char* expectedCharacters) {
41 while (*expectedCharacters)
42 source.advanceAndASSERTIgnoringCase(*expectedCharacters++);
43 }
44
45 inline void advanceStringAndASSERT(SegmentedString& source,
46 const char* expectedCharacters) {
47 while (*expectedCharacters)
48 source.advanceAndASSERT(*expectedCharacters++);
49 }
50
51 #if COMPILER(MSVC)
52 // We need to disable the "unreachable code" warning because we want to assert
53 // that some code points aren't reached in the state machine.
54 #pragma warning(disable : 4702)
55 #endif
56
57 #define BEGIN_STATE(prefix, stateName) \
58 case prefix::stateName: \
59 stateName:
60 #define END_STATE() \
61 NOTREACHED(); \
62 break;
63
64 // We use this macro when the HTML5 spec says "reconsume the current input
65 // character in the <mumble> state."
66 #define RECONSUME_IN(prefix, stateName) \
67 do { \
68 m_state = prefix::stateName; \
69 goto stateName; \
70 } while (false)
71
72 // We use this macro when the HTML5 spec says "consume the next input
73 // character ... and switch to the <mumble> state."
74 #define ADVANCE_TO(prefix, stateName) \
75 do { \
76 m_state = prefix::stateName; \
77 if (!m_inputStreamPreprocessor.advance(source)) \
78 return haveBufferedCharacterToken(); \
79 cc = m_inputStreamPreprocessor.nextInputCharacter(); \
80 goto stateName; \
81 } while (false)
82
83 // Sometimes there's more complicated logic in the spec that separates when
84 // we consume the next input character and when we switch to a particular
85 // state. We handle those cases by advancing the source directly and using
86 // this macro to switch to the indicated state.
87 #define SWITCH_TO(prefix, stateName) \
88 do { \
89 m_state = prefix::stateName; \
90 if (source.isEmpty() || !m_inputStreamPreprocessor.peek(source)) \
91 return haveBufferedCharacterToken(); \
92 cc = m_inputStreamPreprocessor.nextInputCharacter(); \
93 goto stateName; \
94 } while (false)
95
96 } // namespace blink
97
98 #endif // MarkupTokenizerInlines_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/xml/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698