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

Side by Side Diff: src/preparser.cc

Issue 812163003: Simplify scanner and generate better error message for legacy octals in templates (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase it Created 6 years 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 | « src/preparser.h ('k') | src/scanner.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 #include <cmath> 5 #include <cmath>
6 6
7 #include "src/allocation.h" 7 #include "src/allocation.h"
8 #include "src/base/logging.h" 8 #include "src/base/logging.h"
9 #include "src/conversions-inl.h" 9 #include "src/conversions-inl.h"
10 #include "src/conversions.h" 10 #include "src/conversions.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 bool ok = true; 118 bool ok = true;
119 int start_position = peek_position(); 119 int start_position = peek_position();
120 ParseLazyFunctionLiteralBody(&ok); 120 ParseLazyFunctionLiteralBody(&ok);
121 if (stack_overflow()) return kPreParseStackOverflow; 121 if (stack_overflow()) return kPreParseStackOverflow;
122 if (!ok) { 122 if (!ok) {
123 ReportUnexpectedToken(scanner()->current_token()); 123 ReportUnexpectedToken(scanner()->current_token());
124 } else { 124 } else {
125 DCHECK_EQ(Token::RBRACE, scanner()->peek()); 125 DCHECK_EQ(Token::RBRACE, scanner()->peek());
126 if (scope_->strict_mode() == STRICT) { 126 if (scope_->strict_mode() == STRICT) {
127 int end_pos = scanner()->location().end_pos; 127 int end_pos = scanner()->location().end_pos;
128 CheckOctalLiteral(start_position, end_pos, &ok); 128 CheckStrictOctalLiteral(start_position, end_pos, &ok);
129 } 129 }
130 } 130 }
131 return kPreParseSuccess; 131 return kPreParseSuccess;
132 } 132 }
133 133
134 134
135 PreParserExpression PreParserTraits::ParseClassLiteral( 135 PreParserExpression PreParserTraits::ParseClassLiteral(
136 PreParserIdentifier name, Scanner::Location class_name_location, 136 PreParserIdentifier name, Scanner::Location class_name_location,
137 bool name_is_strict_reserved, int pos, bool* ok) { 137 bool name_is_strict_reserved, int pos, bool* ok) {
138 return pre_parser_->ParseClassLiteral(name, class_name_location, 138 return pre_parser_->ParseClassLiteral(name, class_name_location,
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 *ok = false; 930 *ok = false;
931 return Expression::Default(); 931 return Expression::Default();
932 } 932 }
933 if (reserved_error_loc.IsValid()) { 933 if (reserved_error_loc.IsValid()) {
934 ReportMessageAt(reserved_error_loc, "unexpected_strict_reserved"); 934 ReportMessageAt(reserved_error_loc, "unexpected_strict_reserved");
935 *ok = false; 935 *ok = false;
936 return Expression::Default(); 936 return Expression::Default();
937 } 937 }
938 938
939 int end_position = scanner()->location().end_pos; 939 int end_position = scanner()->location().end_pos;
940 CheckOctalLiteral(start_position, end_position, CHECK_OK); 940 CheckStrictOctalLiteral(start_position, end_position, CHECK_OK);
941 } 941 }
942 942
943 return Expression::Default(); 943 return Expression::Default();
944 } 944 }
945 945
946 946
947 void PreParser::ParseLazyFunctionLiteralBody(bool* ok) { 947 void PreParser::ParseLazyFunctionLiteralBody(bool* ok) {
948 int body_start = position(); 948 int body_start = position();
949 ParseSourceElements(Token::RBRACE, ok); 949 ParseSourceElements(Token::RBRACE, ok);
950 if (!*ok) return; 950 if (!*ok) return;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 ParseIdentifier(kAllowEvalOrArguments, CHECK_OK); 1012 ParseIdentifier(kAllowEvalOrArguments, CHECK_OK);
1013 ParseArguments(ok); 1013 ParseArguments(ok);
1014 1014
1015 return Expression::Default(); 1015 return Expression::Default();
1016 } 1016 }
1017 1017
1018 #undef CHECK_OK 1018 #undef CHECK_OK
1019 1019
1020 1020
1021 } } // v8::internal 1021 } } // v8::internal
OLDNEW
« no previous file with comments | « src/preparser.h ('k') | src/scanner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698