| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 class Parser { | 416 class Parser { |
| 417 public: | 417 public: |
| 418 Parser(Handle<Script> script, | 418 Parser(Handle<Script> script, |
| 419 bool allow_natives_syntax, | 419 bool allow_natives_syntax, |
| 420 v8::Extension* extension, | 420 v8::Extension* extension, |
| 421 ScriptDataImpl* pre_data); | 421 ScriptDataImpl* pre_data); |
| 422 virtual ~Parser() { } | 422 virtual ~Parser() { } |
| 423 | 423 |
| 424 // Returns NULL if parsing failed. | 424 // Returns NULL if parsing failed. |
| 425 FunctionLiteral* ParseProgram(Handle<String> source, | 425 FunctionLiteral* ParseProgram(Handle<String> source, |
| 426 bool in_global_context); | 426 bool in_global_context, |
| 427 bool strict_mode); |
| 427 | 428 |
| 428 FunctionLiteral* ParseLazy(Handle<SharedFunctionInfo> info); | 429 FunctionLiteral* ParseLazy(Handle<SharedFunctionInfo> info); |
| 429 | 430 |
| 430 void ReportMessageAt(Scanner::Location loc, | 431 void ReportMessageAt(Scanner::Location loc, |
| 431 const char* message, | 432 const char* message, |
| 432 Vector<const char*> args); | 433 Vector<const char*> args); |
| 433 void ReportMessageAt(Scanner::Location loc, | 434 void ReportMessageAt(Scanner::Location loc, |
| 434 const char* message, | 435 const char* message, |
| 435 Vector<Handle<String> > args); | 436 Vector<Handle<String> > args); |
| 436 | 437 |
| 437 protected: | 438 protected: |
| 438 FunctionLiteral* ParseLazy(Handle<SharedFunctionInfo> info, | 439 FunctionLiteral* ParseLazy(Handle<SharedFunctionInfo> info, |
| 439 UC16CharacterStream* source, | 440 UC16CharacterStream* source, |
| 440 ZoneScope* zone_scope); | 441 ZoneScope* zone_scope); |
| 441 enum Mode { | 442 enum Mode { |
| 442 PARSE_LAZILY, | 443 PARSE_LAZILY, |
| 443 PARSE_EAGERLY | 444 PARSE_EAGERLY |
| 444 }; | 445 }; |
| 445 | 446 |
| 446 // Called by ParseProgram after setting up the scanner. | 447 // Called by ParseProgram after setting up the scanner. |
| 447 FunctionLiteral* DoParseProgram(Handle<String> source, | 448 FunctionLiteral* DoParseProgram(Handle<String> source, |
| 448 bool in_global_context, | 449 bool in_global_context, |
| 450 bool strict_mode, |
| 449 ZoneScope* zone_scope); | 451 ZoneScope* zone_scope); |
| 450 | 452 |
| 451 // Report syntax error | 453 // Report syntax error |
| 452 void ReportUnexpectedToken(Token::Value token); | 454 void ReportUnexpectedToken(Token::Value token); |
| 453 void ReportInvalidPreparseData(Handle<String> name, bool* ok); | 455 void ReportInvalidPreparseData(Handle<String> name, bool* ok); |
| 454 void ReportMessage(const char* message, Vector<const char*> args); | 456 void ReportMessage(const char* message, Vector<const char*> args); |
| 455 | 457 |
| 456 bool inside_with() const { return with_nesting_level_ > 0; } | 458 bool inside_with() const { return with_nesting_level_ > 0; } |
| 457 V8JavaScriptScanner& scanner() { return scanner_; } | 459 V8JavaScriptScanner& scanner() { return scanner_; } |
| 458 Mode mode() const { return mode_; } | 460 Mode mode() const { return mode_; } |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 782 Handle<Object> ReportUnexpectedToken() { return Handle<Object>::null(); } | 784 Handle<Object> ReportUnexpectedToken() { return Handle<Object>::null(); } |
| 783 // Converts the currently parsed literal to a JavaScript String. | 785 // Converts the currently parsed literal to a JavaScript String. |
| 784 Handle<String> GetString(); | 786 Handle<String> GetString(); |
| 785 | 787 |
| 786 JsonScanner scanner_; | 788 JsonScanner scanner_; |
| 787 bool stack_overflow_; | 789 bool stack_overflow_; |
| 788 }; | 790 }; |
| 789 } } // namespace v8::internal | 791 } } // namespace v8::internal |
| 790 | 792 |
| 791 #endif // V8_PARSER_H_ | 793 #endif // V8_PARSER_H_ |
| OLD | NEW |