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

Side by Side Diff: src/preparser.cc

Issue 10701116: Sync preparser and parser wrt syntax error in switch..case. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comment Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | test/cctest/test-parsing.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 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 Expect(i::Token::LPAREN, CHECK_OK); 595 Expect(i::Token::LPAREN, CHECK_OK);
596 ParseExpression(true, CHECK_OK); 596 ParseExpression(true, CHECK_OK);
597 Expect(i::Token::RPAREN, CHECK_OK); 597 Expect(i::Token::RPAREN, CHECK_OK);
598 598
599 Expect(i::Token::LBRACE, CHECK_OK); 599 Expect(i::Token::LBRACE, CHECK_OK);
600 i::Token::Value token = peek(); 600 i::Token::Value token = peek();
601 while (token != i::Token::RBRACE) { 601 while (token != i::Token::RBRACE) {
602 if (token == i::Token::CASE) { 602 if (token == i::Token::CASE) {
603 Expect(i::Token::CASE, CHECK_OK); 603 Expect(i::Token::CASE, CHECK_OK);
604 ParseExpression(true, CHECK_OK); 604 ParseExpression(true, CHECK_OK);
605 Expect(i::Token::COLON, CHECK_OK); 605 } else {
606 } else if (token == i::Token::DEFAULT) {
607 Expect(i::Token::DEFAULT, CHECK_OK); 606 Expect(i::Token::DEFAULT, CHECK_OK);
608 Expect(i::Token::COLON, CHECK_OK); 607 }
609 } else { 608 Expect(i::Token::COLON, CHECK_OK);
609 token = peek();
610 while (token != i::Token::CASE &&
611 token != i::Token::DEFAULT &&
612 token != i::Token::RBRACE) {
610 ParseStatement(CHECK_OK); 613 ParseStatement(CHECK_OK);
614 token = peek();
611 } 615 }
612 token = peek();
613 } 616 }
614 Expect(i::Token::RBRACE, ok); 617 Expect(i::Token::RBRACE, ok);
615 return Statement::Default(); 618 return Statement::Default();
616 } 619 }
617 620
618 621
619 PreParser::Statement PreParser::ParseDoWhileStatement(bool* ok) { 622 PreParser::Statement PreParser::ParseDoWhileStatement(bool* ok) {
620 // DoStatement :: 623 // DoStatement ::
621 // 'do' Statement 'while' '(' Expression ')' ';' 624 // 'do' Statement 'while' '(' Expression ')' ';'
622 625
(...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1777 backing_store_.Add(static_cast<byte>((ascii_length >> 14) | 0x80u)); 1780 backing_store_.Add(static_cast<byte>((ascii_length >> 14) | 0x80u));
1778 } 1781 }
1779 backing_store_.Add(static_cast<byte>((ascii_length >> 7) | 0x80u)); 1782 backing_store_.Add(static_cast<byte>((ascii_length >> 7) | 0x80u));
1780 } 1783 }
1781 backing_store_.Add(static_cast<byte>(ascii_length & 0x7f)); 1784 backing_store_.Add(static_cast<byte>(ascii_length & 0x7f));
1782 1785
1783 backing_store_.AddBlock(bytes); 1786 backing_store_.AddBlock(bytes);
1784 return backing_store_.EndSequence().start(); 1787 return backing_store_.EndSequence().start();
1785 } 1788 }
1786 } } // v8::preparser 1789 } } // v8::preparser
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698