| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/css/parser/CSSTokenizer.h" | 5 #include "core/css/parser/CSSTokenizer.h" |
| 6 | 6 |
| 7 namespace blink { | 7 namespace blink { |
| 8 #include "core/CSSTokenizerCodepoints.cpp" | 8 #include "core/CSSTokenizerCodepoints.cpp" |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 } | 203 } |
| 204 | 204 |
| 205 CSSParserToken CSSTokenizer::colon(UChar cc) { | 205 CSSParserToken CSSTokenizer::colon(UChar cc) { |
| 206 return CSSParserToken(ColonToken); | 206 return CSSParserToken(ColonToken); |
| 207 } | 207 } |
| 208 | 208 |
| 209 CSSParserToken CSSTokenizer::semiColon(UChar cc) { | 209 CSSParserToken CSSTokenizer::semiColon(UChar cc) { |
| 210 return CSSParserToken(SemicolonToken); | 210 return CSSParserToken(SemicolonToken); |
| 211 } | 211 } |
| 212 | 212 |
| 213 CSSParserToken CSSTokenizer::hash(UChar cc) { | 213 /* DO NOT SUBMIT - Merge conflict resolution marker. |
| 214 * Please spell |Hash| below (not |GetHash|). */ |
| 215 CSSParserToken CSSTokenizer::Hash(UChar cc) { |
| 214 UChar nextChar = m_input.peekWithoutReplacement(0); | 216 UChar nextChar = m_input.peekWithoutReplacement(0); |
| 215 if (isNameCodePoint(nextChar) || | 217 if (isNameCodePoint(nextChar) || |
| 216 twoCharsAreValidEscape(nextChar, m_input.peekWithoutReplacement(1))) { | 218 twoCharsAreValidEscape(nextChar, m_input.peekWithoutReplacement(1))) { |
| 217 HashTokenType type = | 219 HashTokenType type = |
| 218 nextCharsAreIdentifier() ? HashTokenId : HashTokenUnrestricted; | 220 nextCharsAreIdentifier() ? HashTokenId : HashTokenUnrestricted; |
| 219 return CSSParserToken(type, consumeName()); | 221 return CSSParserToken(type, consumeName()); |
| 220 } | 222 } |
| 221 | 223 |
| 222 return CSSParserToken(DelimiterToken, cc); | 224 return CSSParserToken(DelimiterToken, cc); |
| 223 } | 225 } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 // We could move to the stateful model and instead create | 304 // We could move to the stateful model and instead create |
| 303 // states for all the "next 3 codepoints are X" cases. | 305 // states for all the "next 3 codepoints are X" cases. |
| 304 // State-machine tokenizers are easier to write to handle | 306 // State-machine tokenizers are easier to write to handle |
| 305 // incremental tokenization of partial sources. | 307 // incremental tokenization of partial sources. |
| 306 // However, for now we follow the spec exactly. | 308 // However, for now we follow the spec exactly. |
| 307 UChar cc = consume(); | 309 UChar cc = consume(); |
| 308 CodePoint codePointFunc = 0; | 310 CodePoint codePointFunc = 0; |
| 309 | 311 |
| 310 if (isASCII(cc)) { | 312 if (isASCII(cc)) { |
| 311 SECURITY_DCHECK(cc < codePointsNumber); | 313 SECURITY_DCHECK(cc < codePointsNumber); |
| 312 codePointFunc = codePoints[cc]; | 314 code_point_func = kCodePoints[cc]; |
| 313 } else { | 315 } else { |
| 314 codePointFunc = &CSSTokenizer::nameStart; | 316 codePointFunc = &CSSTokenizer::nameStart; |
| 315 } | 317 } |
| 316 | 318 |
| 317 if (codePointFunc) | 319 if (codePointFunc) |
| 318 return ((this)->*(codePointFunc))(cc); | 320 return ((this)->*(codePointFunc))(cc); |
| 319 return CSSParserToken(DelimiterToken, cc); | 321 return CSSParserToken(DelimiterToken, cc); |
| 320 } | 322 } |
| 321 | 323 |
| 322 // This method merges the following spec sections for efficiency | 324 // This method merges the following spec sections for efficiency |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 reconsume(first); | 677 reconsume(first); |
| 676 return areIdentifier; | 678 return areIdentifier; |
| 677 } | 679 } |
| 678 | 680 |
| 679 StringView CSSTokenizer::registerString(const String& string) { | 681 StringView CSSTokenizer::registerString(const String& string) { |
| 680 m_stringPool.push_back(string); | 682 m_stringPool.push_back(string); |
| 681 return string; | 683 return string; |
| 682 } | 684 } |
| 683 | 685 |
| 684 } // namespace blink | 686 } // namespace blink |
| OLD | NEW |