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

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: 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 Expect(i::Token::COLON, CHECK_OK);
Jakob Kummerow 2012/07/10 18:46:08 nit: The "Expect(...COLON...)" line is in both the
606 } else if (token == i::Token::DEFAULT) { 606 } else {
607 Expect(i::Token::DEFAULT, CHECK_OK); 607 Expect(i::Token::DEFAULT, CHECK_OK);
608 Expect(i::Token::COLON, CHECK_OK); 608 Expect(i::Token::COLON, CHECK_OK);
609 } else {
610 ParseStatement(CHECK_OK);
611 } 609 }
612 token = peek(); 610 token = peek();
611 while (token != i::Token::CASE &&
612 token != i::Token::DEFAULT &&
613 token != i::Token::RBRACE) {
614 ParseStatement(CHECK_OK);
615 token = peek();
616 }
613 } 617 }
614 Expect(i::Token::RBRACE, ok); 618 Expect(i::Token::RBRACE, ok);
615 return Statement::Default(); 619 return Statement::Default();
616 } 620 }
617 621
618 622
619 PreParser::Statement PreParser::ParseDoWhileStatement(bool* ok) { 623 PreParser::Statement PreParser::ParseDoWhileStatement(bool* ok) {
620 // DoStatement :: 624 // DoStatement ::
621 // 'do' Statement 'while' '(' Expression ')' ';' 625 // 'do' Statement 'while' '(' Expression ')' ';'
622 626
(...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1777 backing_store_.Add(static_cast<byte>((ascii_length >> 14) | 0x80u)); 1781 backing_store_.Add(static_cast<byte>((ascii_length >> 14) | 0x80u));
1778 } 1782 }
1779 backing_store_.Add(static_cast<byte>((ascii_length >> 7) | 0x80u)); 1783 backing_store_.Add(static_cast<byte>((ascii_length >> 7) | 0x80u));
1780 } 1784 }
1781 backing_store_.Add(static_cast<byte>(ascii_length & 0x7f)); 1785 backing_store_.Add(static_cast<byte>(ascii_length & 0x7f));
1782 1786
1783 backing_store_.AddBlock(bytes); 1787 backing_store_.AddBlock(bytes);
1784 return backing_store_.EndSequence().start(); 1788 return backing_store_.EndSequence().start();
1785 } 1789 }
1786 } } // v8::preparser 1790 } } // 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