Changeset 173120 in webkit for trunk/Source/JavaScriptCore/parser
- Timestamp:
- Aug 29, 2014, 2:33:30 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/parser/Lexer.cpp
r172380 r173120 507 507 switch (m_current) { 508 508 case 0: 509 return "Invalid character: '\\0'";509 return ASCIILiteral("Invalid character: '\\0'"); 510 510 case 10: 511 return "Invalid character: '\\n'";511 return ASCIILiteral("Invalid character: '\\n'"); 512 512 case 11: 513 return "Invalid character: '\\v'";513 return ASCIILiteral("Invalid character: '\\v'"); 514 514 case 13: 515 return "Invalid character: '\\r'";515 return ASCIILiteral("Invalid character: '\\r'"); 516 516 case 35: 517 return "Invalid character: '#'";517 return ASCIILiteral("Invalid character: '#'"); 518 518 case 64: 519 return "Invalid character: '@'";519 return ASCIILiteral("Invalid character: '@'"); 520 520 case 96: 521 return "Invalid character: '`'";521 return ASCIILiteral("Invalid character: '`'"); 522 522 default: 523 return String::format("Invalid character '\\u%04u'", static_cast<unsigned>(m_current)) .impl();523 return String::format("Invalid character '\\u%04u'", static_cast<unsigned>(m_current)); 524 524 } 525 525 } … … 1027 1027 shift(); 1028 1028 if (!isASCIIHexDigit(m_current) || !isASCIIHexDigit(peek(1))) { 1029 m_lexErrorMessage = "\\x can only be followed by a hex character sequence";1029 m_lexErrorMessage = ASCIILiteral("\\x can only be followed by a hex character sequence"); 1030 1030 return (atEnd() || (isASCIIHexDigit(m_current) && (m_code + 1 == m_codeEnd))) ? StringUnterminated : StringCannotBeParsed; 1031 1031 } … … 1092 1092 shift(); 1093 1093 if (!isASCIIHexDigit(m_current) || !isASCIIHexDigit(peek(1))) { 1094 m_lexErrorMessage = "\\x can only be followed by a hex character sequence";1094 m_lexErrorMessage = ASCIILiteral("\\x can only be followed by a hex character sequence"); 1095 1095 return StringCannotBeParsed; 1096 1096 } … … 1110 1110 record16('u'); 1111 1111 } else { 1112 m_lexErrorMessage = "\\u can only be followed by a Unicode character sequence";1112 m_lexErrorMessage = ASCIILiteral("\\u can only be followed by a Unicode character sequence"); 1113 1113 return character.valueType() == UnicodeHexValue::IncompleteHex ? StringUnterminated : StringCannotBeParsed; 1114 1114 } … … 1118 1118 shift(); 1119 1119 if (character1 != '0' || isASCIIDigit(m_current)) { 1120 m_lexErrorMessage = "The only valid numeric escape in strict mode is '\\0'";1120 m_lexErrorMessage = ASCIILiteral("The only valid numeric escape in strict mode is '\\0'"); 1121 1121 return StringCannotBeParsed; 1122 1122 } … … 1148 1148 shift(); 1149 1149 } else { 1150 m_lexErrorMessage = "Unterminated string constant";1150 m_lexErrorMessage = ASCIILiteral("Unterminated string constant"); 1151 1151 return StringUnterminated; 1152 1152 } … … 1161 1161 // New-line or end of input is not allowed 1162 1162 if (atEnd() || isLineTerminator(m_current)) { 1163 m_lexErrorMessage = "Unexpected EOF";1163 m_lexErrorMessage = ASCIILiteral("Unexpected EOF"); 1164 1164 return atEnd() ? StringUnterminated : StringCannotBeParsed; 1165 1165 } … … 1523 1523 if (parseMultilineComment()) 1524 1524 goto start; 1525 m_lexErrorMessage = "Multiline comment was not closed properly";1525 m_lexErrorMessage = ASCIILiteral("Multiline comment was not closed properly"); 1526 1526 token = UNTERMINATED_MULTILINE_COMMENT_ERRORTOK; 1527 1527 goto returnError; … … 1649 1649 if ((m_current | 0x20) == 'x') { 1650 1650 if (!isASCIIHexDigit(peek(1))) { 1651 m_lexErrorMessage = "No hexadecimal digits after '0x'";1651 m_lexErrorMessage = ASCIILiteral("No hexadecimal digits after '0x'"); 1652 1652 token = INVALID_HEX_NUMBER_ERRORTOK; 1653 1653 goto returnError; … … 1655 1655 parseHex(tokenData->doubleValue); 1656 1656 if (isIdentStart(m_current)) { 1657 m_lexErrorMessage = "No space between hexadecimal literal and identifier";1657 m_lexErrorMessage = ASCIILiteral("No space between hexadecimal literal and identifier"); 1658 1658 token = INVALID_HEX_NUMBER_ERRORTOK; 1659 1659 goto returnError; … … 1666 1666 record8('0'); 1667 1667 if (strictMode && isASCIIDigit(m_current)) { 1668 m_lexErrorMessage = "Decimal integer literals with a leading zero are forbidden in strict mode";1668 m_lexErrorMessage = ASCIILiteral("Decimal integer literals with a leading zero are forbidden in strict mode"); 1669 1669 token = INVALID_OCTAL_NUMBER_ERRORTOK; 1670 1670 goto returnError; … … 1686 1686 if ((m_current | 0x20) == 'e') { 1687 1687 if (!parseNumberAfterExponentIndicator()) { 1688 m_lexErrorMessage = "Non-number found after exponent indicator";1688 m_lexErrorMessage = ASCIILiteral("Non-number found after exponent indicator"); 1689 1689 token = atEnd() ? UNTERMINATED_NUMERIC_LITERAL_ERRORTOK : INVALID_NUMERIC_LITERAL_ERRORTOK; 1690 1690 goto returnError; … … 1699 1699 // No identifiers allowed directly after numeric literal, e.g. "3in" is bad. 1700 1700 if (UNLIKELY(isIdentStart(m_current))) { 1701 m_lexErrorMessage = "At least one digit must occur after a decimal point";1701 m_lexErrorMessage = ASCIILiteral("At least one digit must occur after a decimal point"); 1702 1702 token = atEnd() ? UNTERMINATED_NUMERIC_LITERAL_ERRORTOK : INVALID_NUMERIC_LITERAL_ERRORTOK; 1703 1703 goto returnError; … … 1750 1750 default: 1751 1751 RELEASE_ASSERT_NOT_REACHED(); 1752 m_lexErrorMessage = "Internal Error";1752 m_lexErrorMessage = ASCIILiteral("Internal Error"); 1753 1753 token = ERRORTOK; 1754 1754 goto returnError;
Note:
See TracChangeset
for help on using the changeset viewer.