OLD | NEW |
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 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 void set_allow_harmony_numeric_literals(bool allow) { | 454 void set_allow_harmony_numeric_literals(bool allow) { |
455 scanner().SetHarmonyNumericLiterals(allow); | 455 scanner().SetHarmonyNumericLiterals(allow); |
456 } | 456 } |
457 | 457 |
458 // Parses the source code represented by the compilation info and sets its | 458 // Parses the source code represented by the compilation info and sets its |
459 // function literal. Returns false (and deallocates any allocated AST | 459 // function literal. Returns false (and deallocates any allocated AST |
460 // nodes) if parsing failed. | 460 // nodes) if parsing failed. |
461 static bool Parse(CompilationInfo* info) { return Parser(info).Parse(); } | 461 static bool Parse(CompilationInfo* info) { return Parser(info).Parse(); } |
462 bool Parse(); | 462 bool Parse(); |
463 | 463 |
464 // Returns NULL if parsing failed. | |
465 FunctionLiteral* ParseProgram(); | |
466 | |
467 void ReportMessageAt(Scanner::Location loc, | 464 void ReportMessageAt(Scanner::Location loc, |
468 const char* message, | 465 const char* message, |
469 Vector<const char*> args); | 466 Vector<const char*> args); |
470 void ReportMessageAt(Scanner::Location loc, | 467 void ReportMessageAt(Scanner::Location loc, |
471 const char* message, | 468 const char* message, |
472 Vector<Handle<String> > args); | 469 Vector<Handle<String> > args); |
473 | 470 |
474 private: | 471 private: |
475 static const int kMaxNumFunctionLocals = 131071; // 2^17-1 | 472 static const int kMaxNumFunctionLocals = 131071; // 2^17-1 |
476 | 473 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 } | 558 } |
562 ~ParsingModeScope() { | 559 ~ParsingModeScope() { |
563 parser_->mode_ = old_mode_; | 560 parser_->mode_ = old_mode_; |
564 } | 561 } |
565 | 562 |
566 private: | 563 private: |
567 Parser* parser_; | 564 Parser* parser_; |
568 Mode old_mode_; | 565 Mode old_mode_; |
569 }; | 566 }; |
570 | 567 |
| 568 // Returns NULL if parsing failed. |
| 569 FunctionLiteral* ParseProgram(); |
| 570 |
571 FunctionLiteral* ParseLazy(); | 571 FunctionLiteral* ParseLazy(); |
572 FunctionLiteral* ParseLazy(Utf16CharacterStream* source); | 572 FunctionLiteral* ParseLazy(Utf16CharacterStream* source); |
573 | 573 |
574 Isolate* isolate() { return isolate_; } | 574 Isolate* isolate() { return isolate_; } |
575 Zone* zone() const { return zone_; } | 575 Zone* zone() const { return zone_; } |
576 CompilationInfo* info() const { return info_; } | 576 CompilationInfo* info() const { return info_; } |
577 | 577 |
578 // Called by ParseProgram after setting up the scanner. | 578 // Called by ParseProgram after setting up the scanner. |
579 FunctionLiteral* DoParseProgram(CompilationInfo* info, | 579 FunctionLiteral* DoParseProgram(CompilationInfo* info, |
580 Handle<String> source); | 580 Handle<String> source); |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
906 private: | 906 private: |
907 static const int kLiteralTypeSlot = 0; | 907 static const int kLiteralTypeSlot = 0; |
908 static const int kElementsSlot = 1; | 908 static const int kElementsSlot = 1; |
909 | 909 |
910 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 910 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
911 }; | 911 }; |
912 | 912 |
913 } } // namespace v8::internal | 913 } } // namespace v8::internal |
914 | 914 |
915 #endif // V8_PARSER_H_ | 915 #endif // V8_PARSER_H_ |
OLD | NEW |