diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-08-12 09:27:39 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-08-12 09:27:39 +0200 |
commit | 3749d61e1f7a59f5ec5067e560af1eb610c82015 (patch) | |
tree | 73dc228333948738bbe02976cacca8cd382bc978 /Source/JavaScriptCore/parser/Lexer.cpp | |
parent | b32b4dcd9a51ab8de6afc53d9e17f8707e1f7a5e (diff) | |
download | qtwebkit-3749d61e1f7a59f5ec5067e560af1eb610c82015.tar.gz |
Imported WebKit commit a77350243e054f3460d1137301d8b3faee3d2052 (http://svn.webkit.org/repository/webkit/trunk@125365)
New snapshot with build fixes for latest API changes in Qt and all WK1 Win MSVC fixes upstream
Diffstat (limited to 'Source/JavaScriptCore/parser/Lexer.cpp')
-rw-r--r-- | Source/JavaScriptCore/parser/Lexer.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/Source/JavaScriptCore/parser/Lexer.cpp b/Source/JavaScriptCore/parser/Lexer.cpp index 3b020f4f2..2a8a8dc9e 100644 --- a/Source/JavaScriptCore/parser/Lexer.cpp +++ b/Source/JavaScriptCore/parser/Lexer.cpp @@ -417,6 +417,7 @@ void Lexer<T>::setCode(const SourceCode& source, ParserArena* arena) m_codeEnd = m_codeStart + source.endOffset(); m_error = false; m_atLineStart = true; + m_columnNumber = 0; m_lexErrorMessage = UString(); m_buffer8.reserveInitialCapacity(initialReadBufferCapacity); @@ -433,6 +434,7 @@ template <typename T> template <int shiftAmount> ALWAYS_INLINE void Lexer<T>::internalShift() { m_code += shiftAmount; + m_columnNumber += shiftAmount; m_current = *m_code; } @@ -444,6 +446,7 @@ ALWAYS_INLINE void Lexer<T>::shift() ++m_code; if (LIKELY(m_code < m_codeEnd)) m_current = *m_code; + ++m_columnNumber; } template <typename T> @@ -1183,7 +1186,7 @@ bool Lexer<T>::nextTokenIsColon() } template <typename T> -JSTokenType Lexer<T>::lex(JSTokenData* tokenData, JSTokenInfo* tokenInfo, unsigned lexerFlags, bool strictMode) +JSTokenType Lexer<T>::lex(JSTokenData* tokenData, JSTokenLocation* tokenLocation, unsigned lexerFlags, bool strictMode) { ASSERT(!m_error); ASSERT(m_buffer8.isEmpty()); @@ -1199,7 +1202,8 @@ start: if (atEnd()) return EOFTOK; - tokenInfo->startOffset = currentOffset(); + tokenLocation->startOffset = currentOffset(); + tokenLocation->column = m_columnNumber; CharacterType type; if (LIKELY(isLatin1(m_current))) @@ -1522,6 +1526,7 @@ inNumberAfterDecimalPoint: shiftLineTerminator(); m_atLineStart = true; m_terminator = true; + m_columnNumber = 0; goto start; case CharacterInvalid: m_lexErrorMessage = invalidCharacterMessage(); @@ -1544,6 +1549,7 @@ inSingleLineComment: shiftLineTerminator(); m_atLineStart = true; m_terminator = true; + m_columnNumber = 0; if (!lastTokenWasRestrKeyword()) goto start; @@ -1551,15 +1557,15 @@ inSingleLineComment: // Fall through into returnToken. returnToken: - tokenInfo->line = m_lineNumber; - tokenInfo->endOffset = currentOffset(); + tokenLocation->line = m_lineNumber; + tokenLocation->endOffset = currentOffset(); m_lastToken = token; return token; returnError: m_error = true; - tokenInfo->line = m_lineNumber; - tokenInfo->endOffset = currentOffset(); + tokenLocation->line = m_lineNumber; + tokenLocation->endOffset = currentOffset(); return ERRORTOK; } |