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

Side by Side Diff: src/parsing/parser-base.h

Issue 1793913002: [parser] implement error reporting for Scanner errors (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebased Created 4 years, 9 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #ifndef V8_PARSING_PARSER_BASE_H 5 #ifndef V8_PARSING_PARSER_BASE_H
6 #define V8_PARSING_PARSER_BASE_H 6 #define V8_PARSING_PARSER_BASE_H
7 7
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/bailout-reason.h" 9 #include "src/bailout-reason.h"
10 #include "src/hashmap.h" 10 #include "src/hashmap.h"
(...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after
1005 void ParserBase<Traits>::ReportUnexpectedToken(Token::Value token) { 1005 void ParserBase<Traits>::ReportUnexpectedToken(Token::Value token) {
1006 return ReportUnexpectedTokenAt(scanner_->location(), token); 1006 return ReportUnexpectedTokenAt(scanner_->location(), token);
1007 } 1007 }
1008 1008
1009 1009
1010 template <class Traits> 1010 template <class Traits>
1011 void ParserBase<Traits>::ReportUnexpectedTokenAt( 1011 void ParserBase<Traits>::ReportUnexpectedTokenAt(
1012 Scanner::Location source_location, Token::Value token, 1012 Scanner::Location source_location, Token::Value token,
1013 MessageTemplate::Template message) { 1013 MessageTemplate::Template message) {
1014 const char* arg; 1014 const char* arg;
1015 if (token == Token::ILLEGAL && scanner()->has_error()) {
adamk 2016/03/18 18:21:55 Can you put this logic inside GetUnexpectedToken i
caitp (gmail) 2016/03/21 16:15:03 Done.
1016 Traits::ReportMessageAt(scanner()->error_location(), scanner()->error());
1017 return;
1018 }
1015 GetUnexpectedTokenMessage(token, &message, &arg); 1019 GetUnexpectedTokenMessage(token, &message, &arg);
1016 Traits::ReportMessageAt(source_location, message, arg); 1020 Traits::ReportMessageAt(source_location, message, arg);
1017 } 1021 }
1018 1022
1019 1023
1020 template <class Traits> 1024 template <class Traits>
1021 typename ParserBase<Traits>::IdentifierT ParserBase<Traits>::ParseIdentifier( 1025 typename ParserBase<Traits>::IdentifierT ParserBase<Traits>::ParseIdentifier(
1022 AllowRestrictedIdentifiers allow_restricted_identifiers, bool* ok) { 1026 AllowRestrictedIdentifiers allow_restricted_identifiers, bool* ok) {
1023 ExpressionClassifier classifier(this); 1027 ExpressionClassifier classifier(this);
1024 auto result = ParseAndClassifyIdentifier(&classifier, ok); 1028 auto result = ParseAndClassifyIdentifier(&classifier, ok);
(...skipping 2062 matching lines...) Expand 10 before | Expand all | Expand 10 after
3087 has_seen_constructor_ = true; 3091 has_seen_constructor_ = true;
3088 return; 3092 return;
3089 } 3093 }
3090 } 3094 }
3091 3095
3092 3096
3093 } // namespace internal 3097 } // namespace internal
3094 } // namespace v8 3098 } // namespace v8
3095 3099
3096 #endif // V8_PARSING_PARSER_BASE_H 3100 #endif // V8_PARSING_PARSER_BASE_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698