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

Unified Diff: src/parser.cc

Issue 5136002: Extract scanner base/JS/JSON and move base and JS to scanner-base. (Closed)
Patch Set: Created 10 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/parser.h ('k') | src/prescanner.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index a9ba0e716914fc5ff215efaf0dcdad43337c3dd8..c454099ade7f191a896e780bff7b80eba174af37 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -728,7 +728,7 @@ FunctionLiteral* Parser::ParseProgram(Handle<String> source,
// Initialize parser state.
source->TryFlatten();
- scanner_.Initialize(source, JAVASCRIPT);
+ scanner_.Initialize(source);
ASSERT(target_stack_ == NULL);
if (pre_data_ != NULL) pre_data_->Initialize();
@@ -791,8 +791,7 @@ FunctionLiteral* Parser::ParseLazy(Handle<SharedFunctionInfo> info) {
// Initialize parser state.
source->TryFlatten();
- scanner_.Initialize(source, info->start_position(), info->end_position(),
- JAVASCRIPT);
+ scanner_.Initialize(source, info->start_position(), info->end_position());
ASSERT(target_stack_ == NULL);
mode_ = PARSE_EAGERLY;
@@ -3613,7 +3612,7 @@ Expression* Parser::NewThrowError(Handle<String> constructor,
Handle<Object> JsonParser::ParseJson(Handle<String> source) {
source->TryFlatten();
- scanner_.Initialize(source, JSON);
+ scanner_.Initialize(source);
Handle<Object> result = ParseJsonValue();
if (result.is_null() || scanner_.Next() != Token::EOS) {
if (scanner_.stack_overflow()) {
@@ -4641,10 +4640,9 @@ int ScriptDataImpl::ReadNumber(byte** source) {
static ScriptDataImpl* DoPreParse(UTF16Buffer* stream,
bool allow_lazy,
PartialParserRecorder* recorder) {
- typedef preparser::Scanner<UTF16Buffer, UTF8Buffer> PreScanner;
- PreScanner scanner;
+ preparser::Scanner scanner;
scanner.Initialize(stream);
- preparser::PreParser<PreScanner, PartialParserRecorder> preparser;
+ preparser::PreParser<preparser::Scanner, PartialParserRecorder> preparser;
if (!preparser.PreParseProgram(&scanner, recorder, allow_lazy)) {
Top::StackOverflow();
return NULL;
« no previous file with comments | « src/parser.h ('k') | src/prescanner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698