2011-07-01 Juan C. Montemayor <jmont@apple.com>

        Reviewed by Oliver Hunt.

        Lexer error messages are currently appalling
        https://bugs.webkit.org/show_bug.cgi?id=63340

        Updated expected test results.

        * fast/js/basic-strict-mode-expected.txt:
        * fast/js/kde/parse-expected.txt:
        * fast/js/kde/string-1-n-expected.txt:
        * fast/js/kde/string-2-n-expected.txt:
        * fast/js/numeric-escapes-in-string-literals-expected.txt:
        * fast/js/removing-Cf-characters-expected.txt:
        * fast/regex/non-pattern-characters-expected.txt:
        * http/tests/websocket/tests/bad-sub-protocol-control-chars-expected.txt:
        * loader/reload-subresource-when-type-changes-expected.txt:
        * sputnik/Conformance/07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A2.1_T1-expected.txt:
        * sputnik/Conformance/07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A2.1_T2-expected.txt:
        * sputnik/Conformance/07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A2.2_T1-expected.txt:
        * sputnik/Conformance/07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A2.2_T2-expected.txt:
        * sputnik/Conformance/07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A2.3-expected.txt:
        * sputnik/Conformance/07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A2.4-expected.txt:
        * sputnik/Conformance/07_Lexical_Conventions/7.4_Comments/S7.4_A2_T2-expected.txt:
        * sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.3_Numeric_Literals/S7.8.3_A6.1_T1-expected.txt:
        * sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.3_Numeric_Literals/S7.8.3_A6.1_T2-expected.txt:
        * sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.3_Numeric_Literals/S7.8.3_A6.2_T1-expected.txt:
        * sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.3_Numeric_Literals/S7.8.3_A6.2_T2-expected.txt:
        * sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A1.1_T1-expected.txt:
        * sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A1.1_T2-expected.txt:
        * sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A1.2_T1-expected.txt:
        * sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A1.2_T2-expected.txt:
        * sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A3.1_T1-expected.txt:
        * sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A3.1_T2-expected.txt:
        * sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A3.2_T1-expected.txt:
        * sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A3.2_T2-expected.txt:
        * sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A7.1_T4-expected.txt:
        * sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A7.2_T1-expected.txt:
        * sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A7.2_T2-expected.txt:
        * sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A7.2_T3-expected.txt:
        * sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A7.2_T4-expected.txt:
        * sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A7.2_T5-expected.txt:
        * sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A7.2_T6-expected.txt:
        * sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.5_Regular_Expression_Literals/S7.8.5_A1.2_T1-expected.txt:
        * sputnik/Conformance/08_Types/8.4_The_String_Type/S8.4_A13_T1-expected.txt:
        * sputnik/Conformance/08_Types/8.4_The_String_Type/S8.4_A13_T2-expected.txt:
        * sputnik/Conformance/08_Types/8.4_The_String_Type/S8.4_A14_T1-expected.txt:
        * sputnik/Conformance/08_Types/8.4_The_String_Type/S8.4_A14_T2-expected.txt:
2011-07-01  Juan C. Montemayor  <jmont@apple.com>

        Reviewed by Oliver Hunt.

        Lexer error messages are currently appalling
        https://bugs.webkit.org/show_bug.cgi?id=63340

        Added error messages for the Lexer. These messages will be displayed
        instead of the lexer error messages from the parser that are currently
        shown.

        * parser/Lexer.cpp:
        (JSC::Lexer::getInvalidCharMessage):
        (JSC::Lexer::setCode):
        (JSC::Lexer::parseString):
        (JSC::Lexer::lex):
        (JSC::Lexer::clear):
        * parser/Lexer.h:
        (JSC::Lexer::getErrorMessage):
        (JSC::Lexer::setOffset):
        * parser/Parser.cpp:
        (JSC::Parser::parse):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@90265 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 6694a30a
2011-07-01 Juan C. Montemayor <jmont@apple.com>
Reviewed by Oliver Hunt.
Lexer error messages are currently appalling
https://bugs.webkit.org/show_bug.cgi?id=63340
Updated expected test results.
* fast/js/basic-strict-mode-expected.txt:
* fast/js/kde/parse-expected.txt:
* fast/js/kde/string-1-n-expected.txt:
* fast/js/kde/string-2-n-expected.txt:
* fast/js/numeric-escapes-in-string-literals-expected.txt:
* fast/js/removing-Cf-characters-expected.txt:
* fast/regex/non-pattern-characters-expected.txt:
* http/tests/websocket/tests/bad-sub-protocol-control-chars-expected.txt:
* loader/reload-subresource-when-type-changes-expected.txt:
* sputnik/Conformance/07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A2.1_T1-expected.txt:
* sputnik/Conformance/07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A2.1_T2-expected.txt:
* sputnik/Conformance/07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A2.2_T1-expected.txt:
* sputnik/Conformance/07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A2.2_T2-expected.txt:
* sputnik/Conformance/07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A2.3-expected.txt:
* sputnik/Conformance/07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A2.4-expected.txt:
* sputnik/Conformance/07_Lexical_Conventions/7.4_Comments/S7.4_A2_T2-expected.txt:
* sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.3_Numeric_Literals/S7.8.3_A6.1_T1-expected.txt:
* sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.3_Numeric_Literals/S7.8.3_A6.1_T2-expected.txt:
* sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.3_Numeric_Literals/S7.8.3_A6.2_T1-expected.txt:
* sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.3_Numeric_Literals/S7.8.3_A6.2_T2-expected.txt:
* sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A1.1_T1-expected.txt:
* sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A1.1_T2-expected.txt:
* sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A1.2_T1-expected.txt:
* sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A1.2_T2-expected.txt:
* sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A3.1_T1-expected.txt:
* sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A3.1_T2-expected.txt:
* sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A3.2_T1-expected.txt:
* sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A3.2_T2-expected.txt:
* sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A7.1_T4-expected.txt:
* sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A7.2_T1-expected.txt:
* sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A7.2_T2-expected.txt:
* sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A7.2_T3-expected.txt:
* sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A7.2_T4-expected.txt:
* sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A7.2_T5-expected.txt:
* sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.4_String_Literals/S7.8.4_A7.2_T6-expected.txt:
* sputnik/Conformance/07_Lexical_Conventions/7.8_Literals/7.8.5_Regular_Expression_Literals/S7.8.5_A1.2_T1-expected.txt:
* sputnik/Conformance/08_Types/8.4_The_String_Type/S8.4_A13_T1-expected.txt:
* sputnik/Conformance/08_Types/8.4_The_String_Type/S8.4_A13_T2-expected.txt:
* sputnik/Conformance/08_Types/8.4_The_String_Type/S8.4_A14_T1-expected.txt:
* sputnik/Conformance/08_Types/8.4_The_String_Type/S8.4_A14_T2-expected.txt:
2011-07-01 Adam Roben <aroben@apple.com>
Add Leopard expected failure result for media/media-blocked-by-beforeload.html
......
......@@ -86,12 +86,12 @@ PASS 'use strict'; for(;;)break missingLabel threw exception SyntaxError: Label
PASS (function(){'use strict'; for(;;)break missingLabel}) threw exception SyntaxError: Label 'missingLabel' is not defined.
PASS 'use strict'; for(;;)continue missingLabel threw exception SyntaxError: Label 'missingLabel' is not defined.
PASS (function(){'use strict'; for(;;)continue missingLabel}) threw exception SyntaxError: Label 'missingLabel' is not defined.
PASS 'use strict'; 007; threw exception SyntaxError: Unrecognized token '007'.
PASS (function(){'use strict'; 007;}) threw exception SyntaxError: Unrecognized token '007'.
PASS 'use strict'; '\007'; threw exception SyntaxError: Unrecognized token ''\0'.
PASS (function(){'use strict'; '\007';}) threw exception SyntaxError: Unrecognized token ''\0'.
PASS '\007'; 'use strict'; threw exception SyntaxError: Unrecognized token ''\0'.
PASS (function(){'\007'; 'use strict';}) threw exception SyntaxError: Unrecognized token ''\0'.
PASS 'use strict'; 007; threw exception SyntaxError: Octal escapes are forbidden in strict mode.
PASS (function(){'use strict'; 007;}) threw exception SyntaxError: Octal escapes are forbidden in strict mode.
PASS 'use strict'; '\007'; threw exception SyntaxError: The only valid numeric escape in strict mode is '\0'.
PASS (function(){'use strict'; '\007';}) threw exception SyntaxError: The only valid numeric escape in strict mode is '\0'.
PASS '\007'; 'use strict'; threw exception SyntaxError: The only valid numeric escape in strict mode is '\0'.
PASS (function(){'\007'; 'use strict';}) threw exception SyntaxError: The only valid numeric escape in strict mode is '\0'.
PASS 'use strict'; delete aDeletableProperty; threw exception SyntaxError: Cannot delete unqualified property 'aDeletableProperty' in strict mode.
PASS (function(){'use strict'; delete aDeletableProperty;}) threw exception SyntaxError: Cannot delete unqualified property 'aDeletableProperty' in strict mode.
PASS 'use strict'; (function (){ delete someDeclaredGlobal;}) threw exception SyntaxError: Cannot delete unqualified property 'someDeclaredGlobal' in strict mode.
......@@ -175,14 +175,14 @@ PASS (function f(arg){'use strict'; var descriptor = Object.getOwnPropertyDescri
PASS (function f(arg){'use strict'; var descriptor = Object.getOwnPropertyDescriptor(f, 'caller'); return descriptor.get === descriptor.set; })() is true
PASS (function f(arg){'use strict'; var descriptor = Object.getOwnPropertyDescriptor(f, 'arguments'); return descriptor.get === descriptor.set; })() is true
PASS 'use strict'; (function f() { for(var i in this); })(); true; is true
PASS 'use strict'̻ threw exception SyntaxError: Unrecognized token ''.
PASS (function(){'use strict'̻}) threw exception SyntaxError: Unrecognized token ''.
PASS 'use strict'5.f threw exception SyntaxError: Unrecognized token '5.'.
PASS (function(){'use strict'5.f}) threw exception SyntaxError: Unrecognized token '5.'.
PASS 'use strict';̻ threw exception SyntaxError: Unrecognized token ''.
PASS (function(){'use strict';̻}) threw exception SyntaxError: Unrecognized token ''.
PASS 'use strict';5.f threw exception SyntaxError: Unrecognized token '5.'.
PASS (function(){'use strict';5.f}) threw exception SyntaxError: Unrecognized token '5.'.
PASS 'use strict'̻ threw exception SyntaxError: Invalid character '\u0827'.
PASS (function(){'use strict'̻}) threw exception SyntaxError: Invalid character '\u0827'.
PASS 'use strict'5.f threw exception SyntaxError: At least one digit must occur after a decimal point.
PASS (function(){'use strict'5.f}) threw exception SyntaxError: At least one digit must occur after a decimal point.
PASS 'use strict';̻ threw exception SyntaxError: Invalid character '\u0827'.
PASS (function(){'use strict';̻}) threw exception SyntaxError: Invalid character '\u0827'.
PASS 'use strict';5.f threw exception SyntaxError: At least one digit must occur after a decimal point.
PASS (function(){'use strict';5.f}) threw exception SyntaxError: At least one digit must occur after a decimal point.
PASS 'use strict';1-(eval=1); threw exception SyntaxError: 'eval' cannot be modified in strict mode.
PASS (function(){'use strict';1-(eval=1);}) threw exception SyntaxError: 'eval' cannot be modified in strict mode.
PASS 'use strict';arguments=1; threw exception SyntaxError: 'arguments' cannot be modified in strict mode.
......
......@@ -16,7 +16,7 @@ PASS function test() { return 0 } lab: 1 is 1
PASS function test() { while(0) break lab } lab: 1 threw exception SyntaxError: Label 'lab' is not defined.
PASS function test() { while(0) continue lab } lab: 1 threw exception SyntaxError: Label 'lab' is not defined.
PASS var éĀʯΈᢨ = 101; éĀʯΈᢨ; is 101
PASS var f÷; threw exception SyntaxError: Unrecognized token ''.
PASS var f÷; threw exception SyntaxError: Invalid character '\u0247'.
PASS var \u0061 = 102; a is 102
PASS var f\u0030 = 103; f0 is 103
PASS var \u00E9\u0100\u02AF\u0388\u18A8 = 104; \u00E9\u0100\u02AF\u0388\u18A8; is 104
......
CONSOLE MESSAGE: line 1: SyntaxError: Unrecognized token '"unterminated string'
CONSOLE MESSAGE: line 1: SyntaxError: Unexpected EOF
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
......
CONSOLE MESSAGE: line 1: SyntaxError: Unrecognized token '"broken'
CONSOLE MESSAGE: line 1: SyntaxError: Unexpected EOF
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
......
......@@ -6,39 +6,39 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
PASS eval(stringLiteral) is nonStrictResult
PASS eval(stringLiteral) is strictResult
PASS eval(stringLiteral) is nonStrictResult
PASS eval(stringLiteral) threw exception SyntaxError: Unrecognized token '"\1'.
PASS eval(stringLiteral) threw exception SyntaxError: The only valid numeric escape in strict mode is '\0'.
PASS eval(stringLiteral) is nonStrictResult
PASS eval(stringLiteral) threw exception SyntaxError: Unrecognized token '"\7'.
PASS eval(stringLiteral) threw exception SyntaxError: The only valid numeric escape in strict mode is '\0'.
PASS eval(stringLiteral) is nonStrictResult
PASS eval(stringLiteral) threw exception SyntaxError: Unrecognized token '"\8'.
PASS eval(stringLiteral) threw exception SyntaxError: The only valid numeric escape in strict mode is '\0'.
PASS eval(stringLiteral) is nonStrictResult
PASS eval(stringLiteral) threw exception SyntaxError: Unrecognized token '"\9'.
PASS eval(stringLiteral) threw exception SyntaxError: The only valid numeric escape in strict mode is '\0'.
PASS eval(stringLiteral) is nonStrictResult
PASS eval(stringLiteral) threw exception SyntaxError: Unrecognized token '"\0'.
PASS eval(stringLiteral) threw exception SyntaxError: The only valid numeric escape in strict mode is '\0'.
PASS eval(stringLiteral) is nonStrictResult
PASS eval(stringLiteral) threw exception SyntaxError: Unrecognized token '"\0'.
PASS eval(stringLiteral) threw exception SyntaxError: The only valid numeric escape in strict mode is '\0'.
PASS eval(stringLiteral) is nonStrictResult
PASS eval(stringLiteral) threw exception SyntaxError: Unrecognized token '"\0'.
PASS eval(stringLiteral) threw exception SyntaxError: The only valid numeric escape in strict mode is '\0'.
PASS eval(stringLiteral) is nonStrictResult
PASS eval(stringLiteral) threw exception SyntaxError: Unrecognized token '"\0'.
PASS eval(stringLiteral) threw exception SyntaxError: The only valid numeric escape in strict mode is '\0'.
PASS eval(stringLiteral) is nonStrictResult
PASS eval(stringLiteral) threw exception SyntaxError: Unrecognized token '"\0'.
PASS eval(stringLiteral) threw exception SyntaxError: The only valid numeric escape in strict mode is '\0'.
PASS eval(stringLiteral) is nonStrictResult
PASS eval(stringLiteral) threw exception SyntaxError: Unrecognized token '"\0'.
PASS eval(stringLiteral) threw exception SyntaxError: The only valid numeric escape in strict mode is '\0'.
PASS eval(stringLiteral) is nonStrictResult
PASS eval(stringLiteral) threw exception SyntaxError: Unrecognized token '"\1'.
PASS eval(stringLiteral) threw exception SyntaxError: The only valid numeric escape in strict mode is '\0'.
PASS eval(stringLiteral) is nonStrictResult
PASS eval(stringLiteral) threw exception SyntaxError: Unrecognized token '"\1'.
PASS eval(stringLiteral) threw exception SyntaxError: The only valid numeric escape in strict mode is '\0'.
PASS eval(stringLiteral) is nonStrictResult
PASS eval(stringLiteral) threw exception SyntaxError: Unrecognized token '"\1'.
PASS eval(stringLiteral) threw exception SyntaxError: The only valid numeric escape in strict mode is '\0'.
PASS eval(stringLiteral) is nonStrictResult
PASS eval(stringLiteral) threw exception SyntaxError: Unrecognized token '"\1'.
PASS eval(stringLiteral) threw exception SyntaxError: The only valid numeric escape in strict mode is '\0'.
PASS eval(stringLiteral) is nonStrictResult
PASS eval(stringLiteral) threw exception SyntaxError: Unrecognized token '"\1'.
PASS eval(stringLiteral) threw exception SyntaxError: The only valid numeric escape in strict mode is '\0'.
PASS eval(stringLiteral) is nonStrictResult
PASS eval(stringLiteral) threw exception SyntaxError: Unrecognized token '"\1'.
PASS eval(stringLiteral) threw exception SyntaxError: The only valid numeric escape in strict mode is '\0'.
PASS eval(stringLiteral) is nonStrictResult
PASS eval(stringLiteral) threw exception SyntaxError: Unrecognized token '"\9'.
PASS eval(stringLiteral) threw exception SyntaxError: The only valid numeric escape in strict mode is '\0'.
PASS successfullyParsed is true
TEST COMPLETE
......
......@@ -9,7 +9,7 @@ PASS 1 is 1
PASS eval('""').length is 1
PASS eval('""').charCodeAt(0) is 0xFEFF
PASS ++1 /* BOM between the +'s */ is 1
PASS var ZWJ_I‍nside; threw exception SyntaxError: Unrecognized token ''.
PASS var ZWJ_I‍nside; threw exception SyntaxError: Invalid character '\u8205'.
PASS successfullyParsed is true
TEST COMPLETE
......
......@@ -51,7 +51,7 @@ PASS regexp.test('aaba') is true
PASS regexp.lastIndex is 2
Testing regexp: [invalid * variations]
PASS /*/ threw exception SyntaxError: Unrecognized token '/*/'.
PASS /*/ threw exception SyntaxError: Multiline comment was not closed properly.
PASS /^*/ threw exception SyntaxError: Invalid regular expression: nothing to repeat.
Testing regexp: /a+/gm
......
......@@ -8,9 +8,9 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
PASS new WebSocket("ws://127.0.0.1:8880/simple", "\0") threw exception Error: SYNTAX_ERR: DOM Exception 12.
PASS new WebSocket("ws://127.0.0.1:8880/simple", " ") threw exception Error: SYNTAX_ERR: DOM Exception 12.
PASS new WebSocket("ws://127.0.0.1:8880/simple", "
") threw exception SyntaxError: Unrecognized token '"'.
") threw exception SyntaxError: Unexpected EOF.
PASS new WebSocket("ws://127.0.0.1:8880/simple", "
") threw exception SyntaxError: Unrecognized token '"'.
") threw exception SyntaxError: Unexpected EOF.
PASS new WebSocket("ws://127.0.0.1:8880/simple", "") threw exception Error: SYNTAX_ERR: DOM Exception 12.
PASS successfullyParsed is true
......
CONSOLE MESSAGE: line 1: SyntaxError: Unrecognized token ''
CONSOLE MESSAGE: line 1: SyntaxError: Invalid character '\u8240'
PASS 1 of 3
PASS 2 of 3
PASS 3 of 3
......
S7.3_A2.1_T1
PASS SyntaxError: Unrecognized token '''
PASS SyntaxError: Unexpected EOF
TEST COMPLETE
CONSOLE MESSAGE: line 77: SyntaxError: Unrecognized token '"'
CONSOLE MESSAGE: line 77: SyntaxError: Unexpected EOF
S7.3_A2.1_T2
PASS Expected parsing failure
......
S7.3_A2.2_T1
PASS SyntaxError: Unrecognized token '''
PASS SyntaxError: Unexpected EOF
TEST COMPLETE
CONSOLE MESSAGE: line 77: SyntaxError: Unrecognized token '"'
CONSOLE MESSAGE: line 77: SyntaxError: Unexpected EOF
S7.3_A2.2_T2
PASS Expected parsing failure
......
S7.3_A2.3
PASS SyntaxError: Unrecognized token '''
PASS SyntaxError: Unexpected EOF
TEST COMPLETE
S7.3_A2.4
PASS SyntaxError: Unrecognized token '''
PASS SyntaxError: Unexpected EOF
TEST COMPLETE
CONSOLE MESSAGE: line 83: SyntaxError: Unrecognized token '/*CHECK#1/
} catch (ex) {
sputnikException = ex;
}
var successfullyParsed = true;
'
CONSOLE MESSAGE: line 83: SyntaxError: Multiline comment was not closed properly
S7.4_A2_T2
PASS Expected parsing failure
......
CONSOLE MESSAGE: line 77: SyntaxError: Unrecognized token '0'
CONSOLE MESSAGE: line 77: SyntaxError: At least one digit must occur after a decimal point
S7.8.3_A6.1_T1
PASS Expected parsing failure
......
CONSOLE MESSAGE: line 77: SyntaxError: Unrecognized token '0'
CONSOLE MESSAGE: line 77: SyntaxError: At least one digit must occur after a decimal point
S7.8.3_A6.1_T2
PASS Expected parsing failure
......
CONSOLE MESSAGE: line 77: SyntaxError: Unrecognized token '0'
CONSOLE MESSAGE: line 77: SyntaxError: At least one digit must occur after a decimal point
S7.8.3_A6.2_T1
PASS Expected parsing failure
......
CONSOLE MESSAGE: line 77: SyntaxError: Unrecognized token '0'
CONSOLE MESSAGE: line 77: SyntaxError: At least one digit must occur after a decimal point
S7.8.3_A6.2_T2
PASS Expected parsing failure
......
CONSOLE MESSAGE: line 77: SyntaxError: Unrecognized token '"'
CONSOLE MESSAGE: line 77: SyntaxError: Unexpected EOF
S7.8.4_A1.1_T1
PASS Expected parsing failure
......
CONSOLE MESSAGE: line 77: SyntaxError: Unrecognized token '"'
CONSOLE MESSAGE: line 77: SyntaxError: Unexpected EOF
S7.8.4_A1.1_T2
PASS Expected parsing failure
......
CONSOLE MESSAGE: line 77: SyntaxError: Unrecognized token '''
CONSOLE MESSAGE: line 77: SyntaxError: Unexpected EOF
S7.8.4_A1.2_T1
PASS Expected parsing failure
......
CONSOLE MESSAGE: line 77: SyntaxError: Unrecognized token '''
CONSOLE MESSAGE: line 77: SyntaxError: Unexpected EOF
S7.8.4_A1.2_T2
PASS Expected parsing failure
......
CONSOLE MESSAGE: line 77: SyntaxError: Unrecognized token '"\"'
CONSOLE MESSAGE: line 77: SyntaxError: Unexpected EOF
S7.8.4_A3.1_T1
PASS Expected parsing failure
......
CONSOLE MESSAGE: line 77: SyntaxError: Unrecognized token ''\''
CONSOLE MESSAGE: line 77: SyntaxError: Unexpected EOF
S7.8.4_A3.1_T2
PASS Expected parsing failure
......
CONSOLE MESSAGE: line 77: SyntaxError: Unrecognized token '"\\\"'
CONSOLE MESSAGE: line 77: SyntaxError: Unexpected EOF
S7.8.4_A3.2_T1
PASS Expected parsing failure
......
CONSOLE MESSAGE: line 77: SyntaxError: Unrecognized token ''\\\''
CONSOLE MESSAGE: line 77: SyntaxError: Unexpected EOF
S7.8.4_A3.2_T2
PASS Expected parsing failure
......
CONSOLE MESSAGE: line 77: SyntaxError: Unrecognized token '"\u'
CONSOLE MESSAGE: line 77: SyntaxError: \u can only be followed by a Unicode character sequence
S7.8.4_A7.1_T4
PASS Expected parsing failure
......
CONSOLE MESSAGE: line 77: SyntaxError: Unrecognized token '"\u'
CONSOLE MESSAGE: line 77: SyntaxError: \u can only be followed by a Unicode character sequence
S7.8.4_A7.2_T1
PASS Expected parsing failure
......
CONSOLE MESSAGE: line 77: SyntaxError: Unrecognized token '"\u'
CONSOLE MESSAGE: line 77: SyntaxError: \u can only be followed by a Unicode character sequence
S7.8.4_A7.2_T2
PASS Expected parsing failure
......
CONSOLE MESSAGE: line 77: SyntaxError: Unrecognized token '"\u'
CONSOLE MESSAGE: line 77: SyntaxError: \u can only be followed by a Unicode character sequence
S7.8.4_A7.2_T3
PASS Expected parsing failure
......
CONSOLE MESSAGE: line 77: SyntaxError: Unrecognized token '"\u'
CONSOLE MESSAGE: line 77: SyntaxError: \u can only be followed by a Unicode character sequence
S7.8.4_A7.2_T4
PASS Expected parsing failure
......
CONSOLE MESSAGE: line 77: SyntaxError: Unrecognized token '"\u'
CONSOLE MESSAGE: line 77: SyntaxError: \u can only be followed by a Unicode character sequence
S7.8.4_A7.2_T5
PASS Expected parsing failure
......
CONSOLE MESSAGE: line 77: SyntaxError: Unrecognized token '"\u'
CONSOLE MESSAGE: line 77: SyntaxError: \u can only be followed by a Unicode character sequence
S7.8.4_A7.2_T6
PASS Expected parsing failure
......
CONSOLE MESSAGE: line 84: SyntaxError: Unrecognized token '/*/
} catch (ex) {
sputnikException = ex;
}
var successfullyParsed = true;
'
CONSOLE MESSAGE: line 84: SyntaxError: Multiline comment was not closed properly
S7.8.5_A1.2_T1
PASS Expected parsing failure
......
CONSOLE MESSAGE: line 76: SyntaxError: Unrecognized token '';'
CONSOLE MESSAGE: line 76: SyntaxError: Unexpected EOF
S8.4_A13_T1
PASS Expected parsing failure
......
CONSOLE MESSAGE: line 76: SyntaxError: Unrecognized token '';'
CONSOLE MESSAGE: line 76: SyntaxError: Unexpected EOF
S8.4_A13_T2
PASS Expected parsing failure
......
CONSOLE MESSAGE: line 76: SyntaxError: Unrecognized token '";'
CONSOLE MESSAGE: line 76: SyntaxError: Unexpected EOF
S8.4_A14_T1
PASS Expected parsing failure
......
CONSOLE MESSAGE: line 76: SyntaxError: Unrecognized token '";'
CONSOLE MESSAGE: line 76: SyntaxError: Unexpected EOF
S8.4_A14_T2
PASS Expected parsing failure
......
2011-07-01 Juan C. Montemayor <jmont@apple.com>
Reviewed by Oliver Hunt.
Lexer error messages are currently appalling
https://bugs.webkit.org/show_bug.cgi?id=63340
Added error messages for the Lexer. These messages will be displayed
instead of the lexer error messages from the parser that are currently
shown.
* parser/Lexer.cpp:
(JSC::Lexer::getInvalidCharMessage):
(JSC::Lexer::setCode):
(JSC::Lexer::parseString):
(JSC::Lexer::lex):
(JSC::Lexer::clear):
* parser/Lexer.h:
(JSC::Lexer::getErrorMessage):
(JSC::Lexer::setOffset):
* parser/Parser.cpp:
(JSC::Parser::parse):
2011-07-01 Jungshik Shin <jshin@chromium.org>
Reviewed by Alexey Proskuryakov.
......
......@@ -233,6 +233,28 @@ Lexer::~Lexer()
{
m_keywordTable.deleteTable();
}
UString Lexer::getInvalidCharMessage()
{
switch (m_current) {
case 0:
return "Invalid character: '\\0'";
case 10:
return "Invalid character: '\\n'";
case 11:
return "Invalid character: '\\v'";
case 13:
return "Invalid character: '\\r'";
case 35:
return "Invalid character: '#'";
case 64:
return "Invalid character: '@'";
case 96:
return "Invalid character: '`'";
default:
return String::format("Invalid character '\\u%04u'", m_current).impl();
}
}
ALWAYS_INLINE const UChar* Lexer::currentCharacter() const
{
......@@ -261,6 +283,7 @@ void Lexer::setCode(const SourceCode& source, ParserArena& arena)
m_codeEnd = data + source.endOffset();
m_error = false;
m_atLineStart = true;
m_lexErrorMessage = UString();
m_buffer8.reserveInitialCapacity(initialReadBufferCapacity);
m_buffer16.reserveInitialCapacity((m_codeEnd - m_code) / 2);
......@@ -527,14 +550,18 @@ template <bool shouldBuildStrings> ALWAYS_INLINE bool Lexer::parseString(JSToken
} else if (m_current == stringQuoteCharacter) {
if (shouldBuildStrings)
record16('u');
} else // Only stringQuoteCharacter allowed after \u
} else {
m_lexErrorMessage = "\\u can only be followed by a Unicode character sequence";
return false;
}
} else if (strictMode && isASCIIDigit(m_current)) {
// The only valid numeric escape in strict mode is '\0', and this must not be followed by a decimal digit.
int character1 = m_current;
shift();
if (character1 != '0' || isASCIIDigit(m_current))
if (character1 != '0' || isASCIIDigit(m_current)) {
m_lexErrorMessage = "The only valid numeric escape in strict mode is '\\0'";
return false;
}
if (shouldBuildStrings)
record16(0);
} else if (!strictMode && isASCIIOctalDigit(m_current)) {
......@@ -561,8 +588,10 @@ template <bool shouldBuildStrings> ALWAYS_INLINE bool Lexer::parseString(JSToken
if (shouldBuildStrings)
record16(m_current);
shift();
} else
} else {
m_lexErrorMessage = "Unterminated string constant";
return false;
}
stringStart = currentCharacter();
continue;
......@@ -572,8 +601,10 @@ template <bool shouldBuildStrings> ALWAYS_INLINE bool Lexer::parseString(JSToken
// as possible, and lets through all common ASCII characters.
if (UNLIKELY(((static_cast<unsigned>(m_current) - 0xE) & 0x2000))) {
// New-line or end of input is not allowed
if (UNLIKELY(isLineTerminator(m_current)) || UNLIKELY(m_current == -1))
if (UNLIKELY(isLineTerminator(m_current)) || UNLIKELY(m_current == -1)) {
m_lexErrorMessage = "Unexpected EOF";
return false;
}
// Anything else is just a normal character
}
shift();
......@@ -923,6 +954,7 @@ start:
shift();
if (parseMultilineComment())
goto start;
m_lexErrorMessage = "Multiline comment was not closed properly";
goto returnError;
}
if (m_current == '=') {
......@@ -1042,8 +1074,10 @@ start:
record8('0');
if (isASCIIOctalDigit(m_current)) {
if (parseOctal(tokenData->doubleValue)) {
if (strictMode)
if (strictMode) {
m_lexErrorMessage = "Octal escapes are forbidden in strict mode";
goto returnError;
}
token = NUMBER;
}
}
......@@ -1058,8 +1092,10 @@ inNumberAfterDecimalPoint:
parseNumberAfterDecimalPoint();
}
if ((m_current | 0x20) == 'e')
if (!parseNumberAfterExponentIndicator())
if (!parseNumberAfterExponentIndicator()) {
m_lexErrorMessage = "Non-number found after exponent indicator";
goto returnError;
}
// Null-terminate string for strtod.
m_buffer8.append('\0');
tokenData->doubleValue = WTF::strtod(m_buffer8.data(), 0);
......@@ -1068,8 +1104,10 @@ inNumberAfterDecimalPoint:
}
// No identifiers allowed directly after numeric literal, e.g. "3in" is bad.
if (UNLIKELY(isIdentStart(m_current)))
if (UNLIKELY(isIdentStart(m_current))) {
m_lexErrorMessage = "At least one digit must occur after a decimal point";
goto returnError;
}
m_buffer8.resize(0);
m_delimited = false;
break;
......@@ -1101,9 +1139,11 @@ inNumberAfterDecimalPoint:
m_terminator = true;
goto start;
case CharacterInvalid:
m_lexErrorMessage = getInvalidCharMessage();
goto returnError;
default:
ASSERT_NOT_REACHED();
m_lexErrorMessage = "Internal Error";
goto returnError;
}
......
......@@ -69,11 +69,13 @@ namespace JSC {
// Functions for use after parsing.
bool sawError() const { return m_error; }
UString getErrorMessage() const { return m_lexErrorMessage; }
void clear();
int currentOffset() { return m_code - m_codeStart; }
void setOffset(int offset)
{
m_error = 0;
m_lexErrorMessage = UString();
m_code = m_codeStart + offset;
m_buffer8.resize(0);
m_buffer16.resize(0);
......@@ -110,6 +112,7 @@ namespace JSC {
int getUnicodeCharacter();
void shiftLineTerminator();
UString getInvalidCharMessage();
ALWAYS_INLINE const UChar* currentCharacter() const;
ALWAYS_INLINE int currentOffset() const;
......@@ -147,6 +150,7 @@ namespace JSC {
bool m_isReparsing;
bool m_atLineStart;
bool m_error;
UString m_lexErrorMessage;
// current and following unicode characters (int to allow for -1 for end-of-file marker)
int m_current;
......
......@@ -51,11 +51,13 @@ void Parser::parse(JSGlobalData* globalData, FunctionParameters* parameters, JSP
UString parseError = jsParse(globalData, parameters, strictness, mode, m_source);
int lineNumber = lexer.lineNumber();
bool lexError = lexer.sawError();
UString lexErrorMessage = lexError ? lexer.getErrorMessage() : UString();
ASSERT(lexErrorMessage.isNull() != lexError);
lexer.clear();
if (!parseError.isNull() || lexError) {