Changeset 88719 in webkit for trunk/Source/JavaScriptCore/parser/Lexer.h
- Timestamp:
- Jun 13, 2011, 3:38:22 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/parser/Lexer.h
r88094 r88719 89 89 90 90 SourceProvider* sourceProvider() const { return m_source->provider(); } 91 91 92 JSTokenType lexExpectIdentifier(JSTokenData* lvalp, JSTokenInfo* llocp, unsigned, bool strictMode); 93 92 94 private: 93 95 friend class JSGlobalData; … … 174 176 return (convertHex(c1, c2) << 8) | convertHex(c3, c4); 175 177 } 178 179 ALWAYS_INLINE const Identifier* Lexer::makeIdentifier(const UChar* characters, size_t length) 180 { 181 return &m_arena->makeIdentifier(m_globalData, characters, length); 182 } 183 184 ALWAYS_INLINE JSTokenType Lexer::lexExpectIdentifier(JSTokenData* lvalp, JSTokenInfo* llocp, unsigned lexType, bool strictMode) 185 { 186 ASSERT((lexType & IgnoreReservedWords)); 187 const UChar* start = m_code; 188 const UChar* ptr = start; 189 const UChar* end = m_codeEnd; 190 if (ptr >= end) { 191 ASSERT(ptr == end); 192 goto slowCase; 193 } 194 if (!WTF::isASCIIAlpha(*ptr)) 195 goto slowCase; 196 ++ptr; 197 while (ptr < end) { 198 if (!WTF::isASCIIAlphanumeric(*ptr)) 199 break; 200 ++ptr; 201 } 202 203 // Here's the shift 204 if (ptr < end) { 205 if (!WTF::isASCII(*ptr) || (*ptr == '\\') || (*ptr == '_')) 206 goto slowCase; 207 m_current = *ptr; 208 } else 209 m_current = -1; 210 211 m_code = ptr; 212 213 // Create the identifier if needed 214 if (lexType & DontBuildKeywords) 215 lvalp->ident = 0; 216 else 217 lvalp->ident = makeIdentifier(start, ptr - start); 218 llocp->line = m_lineNumber; 219 llocp->startOffset = start - m_codeStart; 220 llocp->endOffset = currentOffset(); 221 m_lastToken = IDENT; 222 return IDENT; 223 224 slowCase: 225 return lex(lvalp, llocp, lexType, strictMode); 226 } 176 227 177 228 } // namespace JSC
Note:
See TracChangeset
for help on using the changeset viewer.