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

Side by Side Diff: src/parser.h

Issue 9496003: AST extensions and parsing for import & export declarations. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 9 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 // Check if the given string is 'eval' or 'arguments'. 574 // Check if the given string is 'eval' or 'arguments'.
575 bool IsEvalOrArguments(Handle<String> string); 575 bool IsEvalOrArguments(Handle<String> string);
576 576
577 // All ParseXXX functions take as the last argument an *ok parameter 577 // All ParseXXX functions take as the last argument an *ok parameter
578 // which is set to false if parsing failed; it is unchanged otherwise. 578 // which is set to false if parsing failed; it is unchanged otherwise.
579 // By making the 'exception handling' explicit, we are forced to check 579 // By making the 'exception handling' explicit, we are forced to check
580 // for failure at the call sites. 580 // for failure at the call sites.
581 void* ParseSourceElements(ZoneList<Statement*>* processor, 581 void* ParseSourceElements(ZoneList<Statement*>* processor,
582 int end_token, bool* ok); 582 int end_token, bool* ok);
583 Statement* ParseModuleElement(ZoneStringList* labels, bool* ok); 583 Statement* ParseModuleElement(ZoneStringList* labels, bool* ok);
584 Block* ParseModuleDeclaration(bool* ok); 584 Block* ParseModuleDeclaration(ZoneStringList* names, bool* ok);
585 Module* ParseModule(bool* ok); 585 Module* ParseModule(bool* ok);
586 Module* ParseModuleLiteral(bool* ok); 586 Module* ParseModuleLiteral(bool* ok);
587 Module* ParseModulePath(bool* ok); 587 Module* ParseModulePath(bool* ok);
588 Module* ParseModuleVariable(bool* ok); 588 Module* ParseModuleVariable(bool* ok);
589 Module* ParseModuleUrl(bool* ok); 589 Module* ParseModuleUrl(bool* ok);
590 Module* ParseModuleSpecifier(bool* ok);
590 Block* ParseImportDeclaration(bool* ok); 591 Block* ParseImportDeclaration(bool* ok);
591 Block* ParseExportDeclaration(bool* ok); 592 Statement* ParseExportDeclaration(bool* ok);
592 Statement* ParseBlockElement(ZoneStringList* labels, bool* ok); 593 Statement* ParseBlockElement(ZoneStringList* labels, bool* ok);
593 Statement* ParseStatement(ZoneStringList* labels, bool* ok); 594 Statement* ParseStatement(ZoneStringList* labels, bool* ok);
594 Statement* ParseFunctionDeclaration(bool* ok); 595 Statement* ParseFunctionDeclaration(ZoneStringList* names, bool* ok);
595 Statement* ParseNativeDeclaration(bool* ok); 596 Statement* ParseNativeDeclaration(bool* ok);
596 Block* ParseBlock(ZoneStringList* labels, bool* ok); 597 Block* ParseBlock(ZoneStringList* labels, bool* ok);
597 Block* ParseVariableStatement(VariableDeclarationContext var_context, 598 Block* ParseVariableStatement(VariableDeclarationContext var_context,
599 ZoneStringList* names,
598 bool* ok); 600 bool* ok);
599 Block* ParseVariableDeclarations(VariableDeclarationContext var_context, 601 Block* ParseVariableDeclarations(VariableDeclarationContext var_context,
600 VariableDeclarationProperties* decl_props, 602 VariableDeclarationProperties* decl_props,
603 ZoneStringList* names,
601 Handle<String>* out, 604 Handle<String>* out,
602 bool* ok); 605 bool* ok);
603 Statement* ParseExpressionOrLabelledStatement(ZoneStringList* labels, 606 Statement* ParseExpressionOrLabelledStatement(ZoneStringList* labels,
604 bool* ok); 607 bool* ok);
605 IfStatement* ParseIfStatement(ZoneStringList* labels, bool* ok); 608 IfStatement* ParseIfStatement(ZoneStringList* labels, bool* ok);
606 Statement* ParseContinueStatement(bool* ok); 609 Statement* ParseContinueStatement(bool* ok);
607 Statement* ParseBreakStatement(ZoneStringList* labels, bool* ok); 610 Statement* ParseBreakStatement(ZoneStringList* labels, bool* ok);
608 Statement* ParseReturnStatement(bool* ok); 611 Statement* ParseReturnStatement(bool* ok);
609 Statement* ParseWithStatement(ZoneStringList* labels, bool* ok); 612 Statement* ParseWithStatement(ZoneStringList* labels, bool* ok);
610 CaseClause* ParseCaseClause(bool* default_seen_ptr, bool* ok); 613 CaseClause* ParseCaseClause(bool* default_seen_ptr, bool* ok);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 } 696 }
694 return scanner().Next(); 697 return scanner().Next();
695 } 698 }
696 699
697 bool peek_any_identifier(); 700 bool peek_any_identifier();
698 701
699 INLINE(void Consume(Token::Value token)); 702 INLINE(void Consume(Token::Value token));
700 void Expect(Token::Value token, bool* ok); 703 void Expect(Token::Value token, bool* ok);
701 bool Check(Token::Value token); 704 bool Check(Token::Value token);
702 void ExpectSemicolon(bool* ok); 705 void ExpectSemicolon(bool* ok);
706 void ExpectContextualKeyword(const char* keyword, bool* ok);
703 707
704 Handle<String> LiteralString(PretenureFlag tenured) { 708 Handle<String> LiteralString(PretenureFlag tenured) {
705 if (scanner().is_literal_ascii()) { 709 if (scanner().is_literal_ascii()) {
706 return isolate_->factory()->NewStringFromAscii( 710 return isolate_->factory()->NewStringFromAscii(
707 scanner().literal_ascii_string(), tenured); 711 scanner().literal_ascii_string(), tenured);
708 } else { 712 } else {
709 return isolate_->factory()->NewStringFromTwoByte( 713 return isolate_->factory()->NewStringFromTwoByte(
710 scanner().literal_uc16_string(), tenured); 714 scanner().literal_uc16_string(), tenured);
711 } 715 }
712 } 716 }
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 private: 862 private:
859 static const int kTypeSlot = 0; 863 static const int kTypeSlot = 0;
860 static const int kElementsSlot = 1; 864 static const int kElementsSlot = 1;
861 865
862 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); 866 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue);
863 }; 867 };
864 868
865 } } // namespace v8::internal 869 } } // namespace v8::internal
866 870
867 #endif // V8_PARSER_H_ 871 #endif // V8_PARSER_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/parser.cc » ('j') | test/mjsunit/harmony/module-parsing.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698