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

Unified Diff: src/preparser.h

Issue 153743006: Merge Parser::ReportUnexpectedToken and PreParser::ReportUnexpectedToken. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: . Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/parser.cc ('k') | src/preparser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/preparser.h
diff --git a/src/preparser.h b/src/preparser.h
index 3a68bed6c9f8e23769fe258735d7831a98fc40f3..dc6bdd13f9a4d21a8602b515729168680d7d6b55 100644
--- a/src/preparser.h
+++ b/src/preparser.h
@@ -87,6 +87,8 @@ class ParserBase {
bool stack_overflow() const { return stack_overflow_; }
void set_stack_overflow() { stack_overflow_ = true; }
+ virtual bool is_classic_mode() = 0;
+
INLINE(Token::Value peek()) {
if (stack_overflow_) return Token::ILLEGAL;
return scanner()->peek();
@@ -142,8 +144,13 @@ class ParserBase {
static int Precedence(Token::Value token, bool accept_IN);
// Report syntax errors.
- virtual void ReportUnexpectedToken(Token::Value token) = 0;
- virtual void ReportMessageAt(Scanner::Location loc, const char* type) = 0;
+ void ReportUnexpectedToken(Token::Value token);
+ void ReportMessageAt(Scanner::Location location, const char* type) {
+ ReportMessageAt(location, type, Vector<const char*>::empty());
+ }
+ virtual void ReportMessageAt(Scanner::Location source_location,
+ const char* message,
+ Vector<const char*> args) = 0;
// Used to detect duplicates in object literals. Each of the values
// kGetterProperty, kSetterProperty and kValueProperty represents
@@ -542,9 +549,13 @@ class PreParser : public ParserBase {
};
// Report syntax error
- void ReportUnexpectedToken(Token::Value token);
- void ReportMessageAt(Scanner::Location location, const char* type) {
- ReportMessageAt(location, type, NULL);
+ void ReportMessageAt(Scanner::Location location,
+ const char* message,
+ Vector<const char*> args) {
+ ReportMessageAt(location.beg_pos,
+ location.end_pos,
+ message,
+ args.length() > 0 ? args[0] : NULL);
}
void ReportMessageAt(Scanner::Location location,
const char* type,
@@ -625,7 +636,7 @@ class PreParser : public ParserBase {
scope_->set_language_mode(language_mode);
}
- bool is_classic_mode() {
+ virtual bool is_classic_mode() {
return scope_->language_mode() == CLASSIC_MODE;
}
« no previous file with comments | « src/parser.cc ('k') | src/preparser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698