| OLD | NEW |
| 1 /* | 1 /* |
| 2 Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 3 | 3 |
| 4 This library is free software; you can redistribute it and/or | 4 This library is free software; you can redistribute it and/or |
| 5 modify it under the terms of the GNU Library General Public | 5 modify it under the terms of the GNU Library General Public |
| 6 License as published by the Free Software Foundation; either | 6 License as published by the Free Software Foundation; either |
| 7 version 2 of the License, or (at your option) any later version. | 7 version 2 of the License, or (at your option) any later version. |
| 8 | 8 |
| 9 This library is distributed in the hope that it will be useful, | 9 This library is distributed in the hope that it will be useful, |
| 10 but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 { | 204 { |
| 205 if (m_currentString.length()) | 205 if (m_currentString.length()) |
| 206 m_currentChar = m_currentString.getCurrentChar(); | 206 m_currentChar = m_currentString.getCurrentChar(); |
| 207 updateAdvanceFunctionPointers(); | 207 updateAdvanceFunctionPointers(); |
| 208 } | 208 } |
| 209 | 209 |
| 210 void clear(); | 210 void clear(); |
| 211 void close(); | 211 void close(); |
| 212 | 212 |
| 213 void append(const SegmentedString&); | 213 void append(const SegmentedString&); |
| 214 void prepend(const SegmentedString&); | 214 enum class PrependType { |
| 215 NewInput = 0, |
| 216 Unconsume = 1, |
| 217 }; |
| 218 void prepend(const SegmentedString&, PrependType); |
| 215 | 219 |
| 216 bool excludeLineNumbers() const { return m_currentString.excludeLineNumbers(
); } | 220 bool excludeLineNumbers() const { return m_currentString.excludeLineNumbers(
); } |
| 217 void setExcludeLineNumbers(); | 221 void setExcludeLineNumbers(); |
| 218 | 222 |
| 219 void push(UChar); | 223 void push(UChar); |
| 220 | 224 |
| 221 bool isEmpty() const { return m_empty; } | 225 bool isEmpty() const { return m_empty; } |
| 222 unsigned length() const; | 226 unsigned length() const; |
| 223 | 227 |
| 224 bool isClosed() const { return m_closed; } | 228 bool isClosed() const { return m_closed; } |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 void setCurrentPosition(OrdinalNumber line, OrdinalNumber columnAftreProlog,
int prologLength); | 320 void setCurrentPosition(OrdinalNumber line, OrdinalNumber columnAftreProlog,
int prologLength); |
| 317 | 321 |
| 318 private: | 322 private: |
| 319 enum FastPathFlags { | 323 enum FastPathFlags { |
| 320 NoFastPath = 0, | 324 NoFastPath = 0, |
| 321 Use8BitAdvanceAndUpdateLineNumbers = 1 << 0, | 325 Use8BitAdvanceAndUpdateLineNumbers = 1 << 0, |
| 322 Use8BitAdvance = 1 << 1, | 326 Use8BitAdvance = 1 << 1, |
| 323 }; | 327 }; |
| 324 | 328 |
| 325 void append(const SegmentedSubstring&); | 329 void append(const SegmentedSubstring&); |
| 326 void prepend(const SegmentedSubstring&); | 330 void prepend(const SegmentedSubstring&, PrependType); |
| 327 | 331 |
| 328 void advance8(); | 332 void advance8(); |
| 329 void advance16(); | 333 void advance16(); |
| 330 void advanceAndUpdateLineNumber8(); | 334 void advanceAndUpdateLineNumber8(); |
| 331 void advanceAndUpdateLineNumber16(); | 335 void advanceAndUpdateLineNumber16(); |
| 332 void advanceSlowCase(); | 336 void advanceSlowCase(); |
| 333 void advanceAndUpdateLineNumberSlowCase(); | 337 void advanceAndUpdateLineNumberSlowCase(); |
| 334 void advanceEmpty(); | 338 void advanceEmpty(); |
| 335 void advanceSubstring(); | 339 void advanceSubstring(); |
| 336 | 340 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 { | 396 { |
| 393 unsigned count = string.length(); | 397 unsigned count = string.length(); |
| 394 if (count > length()) | 398 if (count > length()) |
| 395 return NotEnoughCharacters; | 399 return NotEnoughCharacters; |
| 396 UChar* consumedCharacters; | 400 UChar* consumedCharacters; |
| 397 String consumedString = String::createUninitialized(count, consumedChara
cters); | 401 String consumedString = String::createUninitialized(count, consumedChara
cters); |
| 398 advance(count, consumedCharacters); | 402 advance(count, consumedCharacters); |
| 399 LookAheadResult result = DidNotMatch; | 403 LookAheadResult result = DidNotMatch; |
| 400 if (consumedString.startsWith(string, caseSensitivity)) | 404 if (consumedString.startsWith(string, caseSensitivity)) |
| 401 result = DidMatch; | 405 result = DidMatch; |
| 402 prepend(SegmentedString(consumedString)); | 406 prepend(SegmentedString(consumedString), PrependType::Unconsume); |
| 403 return result; | 407 return result; |
| 404 } | 408 } |
| 405 | 409 |
| 406 bool isComposite() const { return !m_substrings.isEmpty(); } | 410 bool isComposite() const { return !m_substrings.isEmpty(); } |
| 407 | 411 |
| 408 SegmentedSubstring m_currentString; | 412 SegmentedSubstring m_currentString; |
| 409 UChar m_currentChar; | 413 UChar m_currentChar; |
| 410 int m_numberOfCharactersConsumedPriorToCurrentString; | 414 int m_numberOfCharactersConsumedPriorToCurrentString; |
| 411 int m_numberOfCharactersConsumedPriorToCurrentLine; | 415 int m_numberOfCharactersConsumedPriorToCurrentLine; |
| 412 int m_currentLine; | 416 int m_currentLine; |
| 413 Deque<SegmentedSubstring> m_substrings; | 417 Deque<SegmentedSubstring> m_substrings; |
| 414 bool m_closed; | 418 bool m_closed; |
| 415 bool m_empty; | 419 bool m_empty; |
| 416 unsigned char m_fastPathFlags; | 420 unsigned char m_fastPathFlags; |
| 417 void (SegmentedString::*m_advanceFunc)(); | 421 void (SegmentedString::*m_advanceFunc)(); |
| 418 void (SegmentedString::*m_advanceAndUpdateLineNumberFunc)(); | 422 void (SegmentedString::*m_advanceAndUpdateLineNumberFunc)(); |
| 419 }; | 423 }; |
| 420 | 424 |
| 421 } // namespace blink | 425 } // namespace blink |
| 422 | 426 |
| 423 #endif | 427 #endif |
| OLD | NEW |