Bug 152697 - Improve unexpected end of script parse error, include expected token
Summary: Improve unexpected end of script parse error, include expected token
Status: ASSIGNED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mark Lam
URL:
Keywords: InRadar
: 153349 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-01-04 10:42 PST by Joseph Pecoraro
Modified: 2016-05-13 15:13 PDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2016-01-04 10:42:19 PST
* SUMMARY
Improve unexpected end of script parse error, include expected token.

The generic "Unexpected end of script" / "Unexpected EOF" errors could be more helpful, and inform what token was missing / expected.

Some examples:

  • inside of function parameter list missing a trailing ')'
  • inside of a block, missing a trailing '}'
  • inside of a string/template string, missing the trailing quote

* TESTS
jsc> print(1
... 
Unexpected end of script:3

jsc> if (1) {
... 
Unexpected end of script:3

jsc> `test
...
Unexpected EOF:2

jsc> 'test
Unexpected EOF:1

jsc> [1
... 
Unexpected end of script:3
Comment 1 Joseph Pecoraro 2016-01-04 10:44:44 PST
Another example. Forgetting to close an array literal.

jsc> [1,
... 
Unexpected end of script:3
Comment 2 Radar WebKit Bug Importer 2016-01-04 10:47:51 PST
<rdar://problem/24043285>
Comment 3 Mark Lam 2016-05-13 13:42:19 PDT
*** Bug 153349 has been marked as a duplicate of this bug. ***