Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(585)

Issue 684873002: Scanner: remove PushBack calls when we're going to return ILLEGAL. (Closed)

Created:
6 years, 1 month ago by marja
Modified:
6 years, 1 month ago
Reviewers:
rossberg
CC:
v8-dev
Project:
v8
Visibility:
Public.

Description

Scanner: remove PushBack calls when we're going to return ILLEGAL. This simplifies escape handling and makes it easier to extend escapes for ES6. PushBack just before detecting ILLEGAL is unnecessary, since we will abort the scanning / parsing anyway at that point, and it doesn't matter where the cursor exactly is. The error messages w/ PushBack are not any better or more correct than without. In addition: remove a comment about handling invalid escapes gracefully when we no longer do. (*) This CL includes a behavioral change: For input "var r = /foobar/g\urrrr;" we used to report "unexpected_token: ILLEGAL" for "\u", but now we report malformed_regexp_flags which is a more correct error message. (Note that the code for reporting invalid_regexp_flags was dead, and invalid_regexp_flags is not the right error message.) Note that the V8 is more relaxed about unicode escapes in regexp flags than ES6 (see http://people.mozilla.org/~jorendorff/es6-draft.html#sec-regular-expressions ) and this CL doesn't change it. (V8 accepts any \uxxxx, ES6 spec says only a certain value range is acceptable.) (*) Code archaeology: Originally, doing PushBack in ScanHexEscape made sense (see e.g., here https://codereview.chromium.org/5063003/diff/6001/src/prescanner.h ), since we wouldn't return ILLEGAL but treat an invalid escape sequence "\uxxxx" as "uxxxx". (The repo at that point contains another instance of the same function, from the initial commit. The logic is the same.) This behavior was changed in a "renaming" commit https://codereview.chromium.org/7739020. BUG= R=rossberg@chromium.org Committed: https://code.google.com/p/v8/source/detail?r=25031

Patch Set 1 #

Patch Set 2 : . #

Patch Set 3 : rebased #

Unified diffs Side-by-side diffs Delta from patch set Stats (+25 lines, -34 lines) Patch
M src/messages.js View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M src/preparser.h View 1 2 1 chunk +1 line, -1 line 0 comments Download
M src/scanner.cc View 1 2 4 chunks +9 lines, -33 lines 0 comments Download
M test/cctest/test-parsing.cc View 1 2 1 chunk +14 lines, -0 lines 0 comments Download

Messages

Total messages: 4 (1 generated)
marja
rossberg, ptal
6 years, 1 month ago (2014-10-31 09:03:00 UTC) #2
rossberg
lgtm
6 years, 1 month ago (2014-10-31 10:02:59 UTC) #3
marja
6 years, 1 month ago (2014-10-31 13:03:27 UTC) #4
Message was sent while issue was closed.
Committed patchset #3 (id:40001) manually as 25031 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698