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

Side by Side Diff: src/preparser.cc

Issue 8384003: Merged Scanner and JavaScriptScanner. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/preparser.h ('k') | src/preparser-api.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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // That means that contextual checks (like a label being declared where 65 // That means that contextual checks (like a label being declared where
66 // it is used) are generally omitted. 66 // it is used) are generally omitted.
67 67
68 void PreParser::ReportUnexpectedToken(i::Token::Value token) { 68 void PreParser::ReportUnexpectedToken(i::Token::Value token) {
69 // We don't report stack overflows here, to avoid increasing the 69 // We don't report stack overflows here, to avoid increasing the
70 // stack depth even further. Instead we report it after parsing is 70 // stack depth even further. Instead we report it after parsing is
71 // over, in ParseProgram. 71 // over, in ParseProgram.
72 if (token == i::Token::ILLEGAL && stack_overflow_) { 72 if (token == i::Token::ILLEGAL && stack_overflow_) {
73 return; 73 return;
74 } 74 }
75 i::JavaScriptScanner::Location source_location = scanner_->location(); 75 i::Scanner::Location source_location = scanner_->location();
76 76
77 // Four of the tokens are treated specially 77 // Four of the tokens are treated specially
78 switch (token) { 78 switch (token) {
79 case i::Token::EOS: 79 case i::Token::EOS:
80 return ReportMessageAt(source_location, "unexpected_eos", NULL); 80 return ReportMessageAt(source_location, "unexpected_eos", NULL);
81 case i::Token::NUMBER: 81 case i::Token::NUMBER:
82 return ReportMessageAt(source_location, "unexpected_token_number", NULL); 82 return ReportMessageAt(source_location, "unexpected_token_number", NULL);
83 case i::Token::STRING: 83 case i::Token::STRING:
84 return ReportMessageAt(source_location, "unexpected_token_string", NULL); 84 return ReportMessageAt(source_location, "unexpected_token_string", NULL);
85 case i::Token::IDENTIFIER: 85 case i::Token::IDENTIFIER:
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 return Statement::Default(); 640 return Statement::Default();
641 } 641 }
642 642
643 643
644 PreParser::Statement PreParser::ParseThrowStatement(bool* ok) { 644 PreParser::Statement PreParser::ParseThrowStatement(bool* ok) {
645 // ThrowStatement :: 645 // ThrowStatement ::
646 // 'throw' [no line terminator] Expression ';' 646 // 'throw' [no line terminator] Expression ';'
647 647
648 Expect(i::Token::THROW, CHECK_OK); 648 Expect(i::Token::THROW, CHECK_OK);
649 if (scanner_->HasAnyLineTerminatorBeforeNext()) { 649 if (scanner_->HasAnyLineTerminatorBeforeNext()) {
650 i::JavaScriptScanner::Location pos = scanner_->location(); 650 i::Scanner::Location pos = scanner_->location();
651 ReportMessageAt(pos, "newline_after_throw", NULL); 651 ReportMessageAt(pos, "newline_after_throw", NULL);
652 *ok = false; 652 *ok = false;
653 return Statement::Default(); 653 return Statement::Default();
654 } 654 }
655 ParseExpression(true, CHECK_OK); 655 ParseExpression(true, CHECK_OK);
656 ExpectSemicolon(ok); 656 ExpectSemicolon(ok);
657 return Statement::Default(); 657 return Statement::Default();
658 } 658 }
659 659
660 660
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after
1714 backing_store_.Add(static_cast<byte>((ascii_length >> 14) | 0x80u)); 1714 backing_store_.Add(static_cast<byte>((ascii_length >> 14) | 0x80u));
1715 } 1715 }
1716 backing_store_.Add(static_cast<byte>((ascii_length >> 7) | 0x80u)); 1716 backing_store_.Add(static_cast<byte>((ascii_length >> 7) | 0x80u));
1717 } 1717 }
1718 backing_store_.Add(static_cast<byte>(ascii_length & 0x7f)); 1718 backing_store_.Add(static_cast<byte>(ascii_length & 0x7f));
1719 1719
1720 backing_store_.AddBlock(bytes); 1720 backing_store_.AddBlock(bytes);
1721 return backing_store_.EndSequence().start(); 1721 return backing_store_.EndSequence().start();
1722 } 1722 }
1723 } } // v8::preparser 1723 } } // v8::preparser
OLDNEW
« no previous file with comments | « src/preparser.h ('k') | src/preparser-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698