| OLD | NEW |
| 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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 | 429 |
| 430 FunctionLiteral* ParseLazy(CompilationInfo* info); | 430 FunctionLiteral* ParseLazy(CompilationInfo* info); |
| 431 | 431 |
| 432 void ReportMessageAt(Scanner::Location loc, | 432 void ReportMessageAt(Scanner::Location loc, |
| 433 const char* message, | 433 const char* message, |
| 434 Vector<const char*> args); | 434 Vector<const char*> args); |
| 435 void ReportMessageAt(Scanner::Location loc, | 435 void ReportMessageAt(Scanner::Location loc, |
| 436 const char* message, | 436 const char* message, |
| 437 Vector<Handle<String> > args); | 437 Vector<Handle<String> > args); |
| 438 | 438 |
| 439 protected: | 439 private: |
| 440 // Limit on number of function parameters is chosen arbitrarily. | 440 // Limit on number of function parameters is chosen arbitrarily. |
| 441 // Code::Flags uses only the low 17 bits of num-parameters to | 441 // Code::Flags uses only the low 17 bits of num-parameters to |
| 442 // construct a hashable id, so if more than 2^17 are allowed, this | 442 // construct a hashable id, so if more than 2^17 are allowed, this |
| 443 // should be checked. | 443 // should be checked. |
| 444 static const int kMaxNumFunctionParameters = 32766; | 444 static const int kMaxNumFunctionParameters = 32766; |
| 445 static const int kMaxNumFunctionLocals = 32767; | 445 static const int kMaxNumFunctionLocals = 32767; |
| 446 FunctionLiteral* ParseLazy(CompilationInfo* info, | 446 FunctionLiteral* ParseLazy(CompilationInfo* info, |
| 447 UC16CharacterStream* source, | 447 UC16CharacterStream* source, |
| 448 ZoneScope* zone_scope); | 448 ZoneScope* zone_scope); |
| 449 enum Mode { | 449 enum Mode { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 463 // Report syntax error | 463 // Report syntax error |
| 464 void ReportUnexpectedToken(Token::Value token); | 464 void ReportUnexpectedToken(Token::Value token); |
| 465 void ReportInvalidPreparseData(Handle<String> name, bool* ok); | 465 void ReportInvalidPreparseData(Handle<String> name, bool* ok); |
| 466 void ReportMessage(const char* message, Vector<const char*> args); | 466 void ReportMessage(const char* message, Vector<const char*> args); |
| 467 | 467 |
| 468 bool inside_with() const { return with_nesting_level_ > 0; } | 468 bool inside_with() const { return with_nesting_level_ > 0; } |
| 469 JavaScriptScanner& scanner() { return scanner_; } | 469 JavaScriptScanner& scanner() { return scanner_; } |
| 470 Mode mode() const { return mode_; } | 470 Mode mode() const { return mode_; } |
| 471 ScriptDataImpl* pre_data() const { return pre_data_; } | 471 ScriptDataImpl* pre_data() const { return pre_data_; } |
| 472 | 472 |
| 473 Scope* DeclarationScope(); |
| 474 |
| 473 // Check if the given string is 'eval' or 'arguments'. | 475 // Check if the given string is 'eval' or 'arguments'. |
| 474 bool IsEvalOrArguments(Handle<String> string); | 476 bool IsEvalOrArguments(Handle<String> string); |
| 475 | 477 |
| 476 // All ParseXXX functions take as the last argument an *ok parameter | 478 // All ParseXXX functions take as the last argument an *ok parameter |
| 477 // which is set to false if parsing failed; it is unchanged otherwise. | 479 // which is set to false if parsing failed; it is unchanged otherwise. |
| 478 // By making the 'exception handling' explicit, we are forced to check | 480 // By making the 'exception handling' explicit, we are forced to check |
| 479 // for failure at the call sites. | 481 // for failure at the call sites. |
| 480 void* ParseSourceElements(ZoneList<Statement*>* processor, | 482 void* ParseSourceElements(ZoneList<Statement*>* processor, |
| 481 int end_token, bool* ok); | 483 int end_token, bool* ok); |
| 482 Statement* ParseStatement(ZoneStringList* labels, bool* ok); | 484 Statement* ParseStatement(ZoneStringList* labels, bool* ok); |
| 483 Statement* ParseFunctionDeclaration(bool* ok); | 485 Statement* ParseFunctionDeclaration(bool* ok); |
| 484 Statement* ParseNativeDeclaration(bool* ok); | 486 Statement* ParseNativeDeclaration(bool* ok); |
| 485 Block* ParseBlock(ZoneStringList* labels, bool* ok); | 487 Block* ParseBlock(ZoneStringList* labels, bool* ok); |
| 486 Block* ParseVariableStatement(bool* ok); | 488 Block* ParseVariableStatement(bool* ok); |
| 487 Block* ParseVariableDeclarations(bool accept_IN, Expression** var, bool* ok); | 489 Block* ParseVariableDeclarations(bool accept_IN, |
| 490 Handle<String>* name, |
| 491 bool* ok); |
| 488 Statement* ParseExpressionOrLabelledStatement(ZoneStringList* labels, | 492 Statement* ParseExpressionOrLabelledStatement(ZoneStringList* labels, |
| 489 bool* ok); | 493 bool* ok); |
| 490 IfStatement* ParseIfStatement(ZoneStringList* labels, bool* ok); | 494 IfStatement* ParseIfStatement(ZoneStringList* labels, bool* ok); |
| 491 Statement* ParseContinueStatement(bool* ok); | 495 Statement* ParseContinueStatement(bool* ok); |
| 492 Statement* ParseBreakStatement(ZoneStringList* labels, bool* ok); | 496 Statement* ParseBreakStatement(ZoneStringList* labels, bool* ok); |
| 493 Statement* ParseReturnStatement(bool* ok); | 497 Statement* ParseReturnStatement(bool* ok); |
| 494 Block* WithHelper(Expression* obj, ZoneStringList* labels, bool* ok); | 498 Block* WithHelper(Expression* obj, ZoneStringList* labels, bool* ok); |
| 495 Statement* ParseWithStatement(ZoneStringList* labels, bool* ok); | 499 Statement* ParseWithStatement(ZoneStringList* labels, bool* ok); |
| 496 CaseClause* ParseCaseClause(bool* default_seen_ptr, bool* ok); | 500 CaseClause* ParseCaseClause(bool* default_seen_ptr, bool* ok); |
| 497 SwitchStatement* ParseSwitchStatement(ZoneStringList* labels, bool* ok); | 501 SwitchStatement* ParseSwitchStatement(ZoneStringList* labels, bool* ok); |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 private: | 751 private: |
| 748 static const int kTypeSlot = 0; | 752 static const int kTypeSlot = 0; |
| 749 static const int kElementsSlot = 1; | 753 static const int kElementsSlot = 1; |
| 750 | 754 |
| 751 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 755 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
| 752 }; | 756 }; |
| 753 | 757 |
| 754 } } // namespace v8::internal | 758 } } // namespace v8::internal |
| 755 | 759 |
| 756 #endif // V8_PARSER_H_ | 760 #endif // V8_PARSER_H_ |
| OLD | NEW |