390ALWAYS_INLINE bool Lexer::parseString(void* lvalp)
391{
392 int stringQuoteCharacter = m_current;
393 shift();
394
395 const UChar* stringStart = currentCharacter();
396
397 while (m_current != stringQuoteCharacter) {
398 if (UNLIKELY(m_current == '\\')) {
399 if (stringStart != currentCharacter())
400 m_buffer16.append(stringStart, currentCharacter() - stringStart);
401 shift();
402
403 int escape = singleEscape(m_current);
404
405 // Most common escape sequences first
406 if (escape) {
407 record16(escape);
408 shift();
409 } else if (UNLIKELY(isLineTerminator(m_current)))
410 shiftLineTerminator();
411 else if (m_current == 'x') {
412 shift();
413 if (isASCIIHexDigit(m_current) && isASCIIHexDigit(peek(1))) {
414 int prev = m_current;
415 shift();
416 record16(convertHex(prev, m_current));
417 shift();
418 } else
419 record16('x');
420 } else if (m_current == 'u') {
421 shift();
422 int character = getUnicodeCharacter();
423 if (character != -1)
424 record16(character);
425 else if (m_current == stringQuoteCharacter)
426 record16('u');
427 else // Only stringQuoteCharacter allowed after \u
428 return false;
429 } else if (isASCIIOctalDigit(m_current)) {
430 // Octal character sequences
431 int character1 = m_current;
432 shift();
433 if (isASCIIOctalDigit(m_current)) {
434 // Two octal characters
435 int character2 = m_current;
436 shift();
437 if (character1 >= '0' && character1 <= '3' && isASCIIOctalDigit(m_current)) {
438 record16((character1 - '0') * 64 + (character2 - '0') * 8 + m_current - '0');
439 shift();
440 } else
441 record16((character1 - '0') * 8 + character2 - '0');
442 } else
443 record16(character1 - '0');
444 } else if (m_current != -1) {
445 record16(m_current);
446 shift();
447 } else
448 return false;
449
450 stringStart = currentCharacter();
451 continue;
452 } else if (UNLIKELY(((static_cast<unsigned>(m_current) - 0xE) & 0x2000))) {
453 // New-line or end of input is not allowed
454 if (UNLIKELY(isLineTerminator(m_current)) || UNLIKELY(m_current == -1))
455 return false;
456 // Anything else is just a normal character
457 }
458 shift();
459 }
460
461 if (currentCharacter() != stringStart)
462 m_buffer16.append(stringStart, currentCharacter() - stringStart);
463 reinterpret_cast<YYSTYPE*>(lvalp)->ident = makeIdentifier(m_buffer16.data(), m_buffer16.size());
464 m_buffer16.resize(0);
465 return true;
466}
467