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

Side by Side Diff: src/parsing/scanner.cc

Issue 2948903002: Reland "[parser] Forbid \08 in strict strings" (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/cctest/test-parsing.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Features shared by parsing and pre-parsing scanners. 5 // Features shared by parsing and pre-parsing scanners.
6 6
7 #include "src/parsing/scanner.h" 7 #include "src/parsing/scanner.h"
8 8
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after
1025 int nx = x * 8 + d; 1025 int nx = x * 8 + d;
1026 if (nx >= 256) break; 1026 if (nx >= 256) break;
1027 x = nx; 1027 x = nx;
1028 Advance<capture_raw>(); 1028 Advance<capture_raw>();
1029 } 1029 }
1030 // Anything except '\0' is an octal escape sequence, illegal in strict mode. 1030 // Anything except '\0' is an octal escape sequence, illegal in strict mode.
1031 // Remember the position of octal escape sequences so that an error 1031 // Remember the position of octal escape sequences so that an error
1032 // can be reported later (in strict mode). 1032 // can be reported later (in strict mode).
1033 // We don't report the error immediately, because the octal escape can 1033 // We don't report the error immediately, because the octal escape can
1034 // occur before the "use strict" directive. 1034 // occur before the "use strict" directive.
1035 if (c != '0' || i > 0) { 1035 if (c != '0' || i > 0 || c0_ == '8' || c0_ == '9') {
1036 octal_pos_ = Location(source_pos() - i - 1, source_pos() - 1); 1036 octal_pos_ = Location(source_pos() - i - 1, source_pos() - 1);
1037 octal_message_ = MessageTemplate::kStrictOctalEscape; 1037 octal_message_ = MessageTemplate::kStrictOctalEscape;
1038 } 1038 }
1039 return x; 1039 return x;
1040 } 1040 }
1041 1041
1042 1042
1043 Token::Value Scanner::ScanString() { 1043 Token::Value Scanner::ScanString() {
1044 uc32 quote = c0_; 1044 uc32 quote = c0_;
1045 Advance<false, false>(); // consume quote 1045 Advance<false, false>(); // consume quote
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
1807 // 2, reset the source to the desired position, 1807 // 2, reset the source to the desired position,
1808 source_->Seek(position); 1808 source_->Seek(position);
1809 // 3, re-scan, by scanning the look-ahead char + 1 token (next_). 1809 // 3, re-scan, by scanning the look-ahead char + 1 token (next_).
1810 c0_ = source_->Advance(); 1810 c0_ = source_->Advance();
1811 Next(); 1811 Next();
1812 DCHECK_EQ(next_.location.beg_pos, static_cast<int>(position)); 1812 DCHECK_EQ(next_.location.beg_pos, static_cast<int>(position));
1813 } 1813 }
1814 1814
1815 } // namespace internal 1815 } // namespace internal
1816 } // namespace v8 1816 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698