Changeset 114844 in webkit for trunk/Source/JavaScriptCore/parser/Lexer.cpp
- Timestamp:
- Apr 21, 2012, 12:46:02 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/parser/Lexer.cpp
r114153 r114844 1 1 /* 2 2 * Copyright (C) 1999-2000 Harri Porten ([email protected]) 3 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All Rights Reserved.3 * Copyright (C) 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All Rights Reserved. 4 4 * Copyright (C) 2007 Cameron Zwarich ([email protected]) 5 5 * Copyright (C) 2010 Zoltan Herczeg ([email protected]) … … 369 369 370 370 template <typename T> 371 UString Lexer<T>:: getInvalidCharMessage()371 UString Lexer<T>::invalidCharacterMessage() const 372 372 { 373 373 switch (m_current) { … … 451 451 ALWAYS_INLINE int Lexer<T>::peek(int offset) 452 452 { 453 // Only use if necessary454 453 ASSERT(offset > 0 && offset < 5); 455 454 const T* code = m_code + offset; … … 458 457 459 458 template <typename T> 460 int Lexer<T>:: getUnicodeCharacter()459 int Lexer<T>::parseFourDigitUnicodeHex() 461 460 { 462 461 int char1 = peek(1); … … 480 479 ASSERT(isLineTerminator(static_cast<T>(m_current))); 481 480 482 int m_prev = m_current;481 int prev = m_current; 483 482 shift(); 484 483 485 484 // Allow both CRLF and LFCR. 486 if ( m_prev + m_current == '\n' + '\r')485 if (prev + m_current == '\n' + '\r') 487 486 shift(); 488 487 … … 634 633 635 634 template <> 636 635 template <bool shouldCreateIdentifier> ALWAYS_INLINE JSTokenType Lexer<LChar>::parseIdentifier(JSTokenData* tokenData, unsigned lexerFlags, bool strictMode) 637 636 { 638 637 const ptrdiff_t remaining = m_codeEnd - m_code; … … 692 691 } 693 692 } 693 694 694 const UChar* identifierStart = currentCharacter(); 695 695 … … 763 763 return ERRORTOK; 764 764 shift(); 765 int character = getUnicodeCharacter();765 int character = parseFourDigitUnicodeHex(); 766 766 if (UNLIKELY(character == -1)) 767 767 return ERRORTOK; … … 911 911 } else if (m_current == 'u') { 912 912 shift(); 913 int character = getUnicodeCharacter();913 int character = parseFourDigitUnicodeHex(); 914 914 if (character != -1) { 915 915 if (shouldBuildStrings) … … 1509 1509 goto start; 1510 1510 case CharacterInvalid: 1511 m_lexErrorMessage = getInvalidCharMessage();1511 m_lexErrorMessage = invalidCharacterMessage(); 1512 1512 goto returnError; 1513 1513 default:
Note:
See TracChangeset
for help on using the changeset viewer.