summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/parser/Lexer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/JavaScriptCore/parser/Lexer.cpp')
-rw-r--r--Source/JavaScriptCore/parser/Lexer.cpp18
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;
}