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

Side by Side Diff: src/parser.h

Issue 9401008: Parsing of basic module declarations (no imports/exports yet). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed Lasse's comments. Created 8 years, 10 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 | « src/heap.cc ('k') | src/parser.cc » ('j') | src/parser.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 // should be checked. 457 // should be checked.
458 static const int kMaxNumFunctionParameters = 32766; 458 static const int kMaxNumFunctionParameters = 32766;
459 static const int kMaxNumFunctionLocals = 32767; 459 static const int kMaxNumFunctionLocals = 32767;
460 460
461 enum Mode { 461 enum Mode {
462 PARSE_LAZILY, 462 PARSE_LAZILY,
463 PARSE_EAGERLY 463 PARSE_EAGERLY
464 }; 464 };
465 465
466 enum VariableDeclarationContext { 466 enum VariableDeclarationContext {
467 kSourceElement, 467 kModuleElement,
468 kBlockElement,
468 kStatement, 469 kStatement,
469 kForStatement 470 kForStatement
470 }; 471 };
471 472
472 // If a list of variable declarations includes any initializers. 473 // If a list of variable declarations includes any initializers.
473 enum VariableDeclarationProperties { 474 enum VariableDeclarationProperties {
474 kHasInitializers, 475 kHasInitializers,
475 kHasNoInitializers 476 kHasNoInitializers
476 }; 477 };
477 478
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 569
569 // Check if the given string is 'eval' or 'arguments'. 570 // Check if the given string is 'eval' or 'arguments'.
570 bool IsEvalOrArguments(Handle<String> string); 571 bool IsEvalOrArguments(Handle<String> string);
571 572
572 // All ParseXXX functions take as the last argument an *ok parameter 573 // All ParseXXX functions take as the last argument an *ok parameter
573 // which is set to false if parsing failed; it is unchanged otherwise. 574 // which is set to false if parsing failed; it is unchanged otherwise.
574 // By making the 'exception handling' explicit, we are forced to check 575 // By making the 'exception handling' explicit, we are forced to check
575 // for failure at the call sites. 576 // for failure at the call sites.
576 void* ParseSourceElements(ZoneList<Statement*>* processor, 577 void* ParseSourceElements(ZoneList<Statement*>* processor,
577 int end_token, bool* ok); 578 int end_token, bool* ok);
578 Statement* ParseSourceElement(ZoneStringList* labels, bool* ok); 579 Statement* ParseModuleElement(ZoneStringList* labels, bool* ok);
580 Block* ParseModuleDeclaration(bool* ok);
581 Module* ParseModule(bool* ok);
582 Module* ParseModuleLiteral(bool* ok);
583 Module* ParseModulePath(bool* ok);
584 Module* ParseModuleVariable(bool* ok);
585 Module* ParseModuleUrl(bool* ok);
586 Block* ParseImportDeclaration(bool* ok);
587 Block* ParseExportDeclaration(bool* ok);
588 Statement* ParseBlockElement(ZoneStringList* labels, bool* ok);
579 Statement* ParseStatement(ZoneStringList* labels, bool* ok); 589 Statement* ParseStatement(ZoneStringList* labels, bool* ok);
580 Statement* ParseFunctionDeclaration(bool* ok); 590 Statement* ParseFunctionDeclaration(bool* ok);
581 Statement* ParseNativeDeclaration(bool* ok); 591 Statement* ParseNativeDeclaration(bool* ok);
582 Block* ParseBlock(ZoneStringList* labels, bool* ok); 592 Block* ParseBlock(ZoneStringList* labels, bool* ok);
583 Block* ParseVariableStatement(VariableDeclarationContext var_context, 593 Block* ParseVariableStatement(VariableDeclarationContext var_context,
584 bool* ok); 594 bool* ok);
585 Block* ParseVariableDeclarations(VariableDeclarationContext var_context, 595 Block* ParseVariableDeclarations(VariableDeclarationContext var_context,
586 VariableDeclarationProperties* decl_props, 596 VariableDeclarationProperties* decl_props,
587 Handle<String>* out, 597 Handle<String>* out,
588 bool* ok); 598 bool* ok);
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 private: 856 private:
847 static const int kTypeSlot = 0; 857 static const int kTypeSlot = 0;
848 static const int kElementsSlot = 1; 858 static const int kElementsSlot = 1;
849 859
850 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); 860 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue);
851 }; 861 };
852 862
853 } } // namespace v8::internal 863 } } // namespace v8::internal
854 864
855 #endif // V8_PARSER_H_ 865 #endif // V8_PARSER_H_
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/parser.cc » ('j') | src/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698