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

Unified Diff: src/lexer/lexer-shell.cc

Issue 83633002: Experimental parser: continue unifying the API with Scanner. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years, 1 month 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/lexer/experimental-scanner.h ('k') | tools/lexer_generator/code_generator.jinja » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/lexer/lexer-shell.cc
diff --git a/src/lexer/lexer-shell.cc b/src/lexer/lexer-shell.cc
index 6c72590e2745dfd728bb1b6ad4beba74192d0527..7b05e40df8e50fea0680ca965bce81a4d3f8cf31 100644
--- a/src/lexer/lexer-shell.cc
+++ b/src/lexer/lexer-shell.cc
@@ -156,16 +156,10 @@ class BaselineScanner {
delete[] source_;
}
- Token::Value Next(int* beg_pos, int* end_pos) {
- Token::Value res = scanner_->Next();
- *beg_pos = scanner_->location().beg_pos;
- *end_pos = scanner_->location().end_pos;
- return res;
- }
+ Scanner* scanner_;
private:
UnicodeCache* unicode_cache_;
- Scanner* scanner_;
const byte* source_;
BufferedUtf16CharacterStream* stream_;
};
@@ -205,7 +199,9 @@ TimeDelta RunBaselineScanner(const char* fname,
Token::Value token;
int beg, end;
do {
- token = scanner.Next(&beg, &end);
+ token = scanner.scanner_->Next();
+ beg = scanner.scanner_->location().beg_pos;
+ end = scanner.scanner_->location().end_pos;
if (dump_tokens) {
tokens->push_back(TokenWithLocation(token, beg, end));
}
@@ -227,17 +223,19 @@ TimeDelta RunExperimentalScanner(const char* fname,
YYCTYPE* buffer = reinterpret_cast<YYCTYPE*>(
ReadFile(fname, &buffer_end, repeat, encoding == UTF8TO16));
+ timer.Start();
ExperimentalScanner<YYCTYPE> scanner(
buffer, reinterpret_cast<YYCTYPE*>(buffer_end), isolate);
scanner.SetHarmonyNumericLiterals(harmony_settings.numeric_literals);
scanner.SetHarmonyModules(harmony_settings.modules);
scanner.SetHarmonyScoping(harmony_settings.scoping);
- timer.Start();
Token::Value token;
int beg, end;
do {
- token = scanner.Next(&beg, &end);
+ token = scanner.Next();
+ beg = scanner.location().beg_pos;
+ end = scanner.location().end_pos;
if (dump_tokens) {
tokens->push_back(TokenWithLocation(token, beg, end));
}
« no previous file with comments | « src/lexer/experimental-scanner.h ('k') | tools/lexer_generator/code_generator.jinja » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698