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 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 stack_overflow_ = true; | 571 stack_overflow_ = true; |
572 } | 572 } |
573 return scanner().Next(); | 573 return scanner().Next(); |
574 } | 574 } |
575 | 575 |
576 INLINE(void Consume(Token::Value token)); | 576 INLINE(void Consume(Token::Value token)); |
577 void Expect(Token::Value token, bool* ok); | 577 void Expect(Token::Value token, bool* ok); |
578 bool Check(Token::Value token); | 578 bool Check(Token::Value token); |
579 void ExpectSemicolon(bool* ok); | 579 void ExpectSemicolon(bool* ok); |
580 | 580 |
| 581 Handle<String> LiteralString(PretenureFlag tenured) { |
| 582 if (scanner().is_literal_ascii()) { |
| 583 return Factory::NewStringFromAscii(scanner().literal_ascii_string(), |
| 584 tenured); |
| 585 } else { |
| 586 return Factory::NewStringFromTwoByte(scanner().literal_uc16_string(), |
| 587 tenured); |
| 588 } |
| 589 } |
| 590 |
| 591 Handle<String> NextLiteralString(PretenureFlag tenured) { |
| 592 if (scanner().is_next_literal_ascii()) { |
| 593 return Factory::NewStringFromAscii(scanner().next_literal_ascii_string(), |
| 594 tenured); |
| 595 } else { |
| 596 return Factory::NewStringFromTwoByte(scanner().next_literal_uc16_string(), |
| 597 tenured); |
| 598 } |
| 599 } |
| 600 |
581 Handle<String> GetSymbol(bool* ok); | 601 Handle<String> GetSymbol(bool* ok); |
582 | 602 |
583 // Get odd-ball literals. | 603 // Get odd-ball literals. |
584 Literal* GetLiteralUndefined(); | 604 Literal* GetLiteralUndefined(); |
585 Literal* GetLiteralTheHole(); | 605 Literal* GetLiteralTheHole(); |
586 Literal* GetLiteralNumber(double value); | 606 Literal* GetLiteralNumber(double value); |
587 | 607 |
588 Handle<String> ParseIdentifier(bool* ok); | 608 Handle<String> ParseIdentifier(bool* ok); |
589 Handle<String> ParseIdentifierName(bool* ok); | 609 Handle<String> ParseIdentifierName(bool* ok); |
590 Handle<String> ParseIdentifierOrGetOrSet(bool* is_get, | 610 Handle<String> ParseIdentifierOrGetOrSet(bool* is_get, |
(...skipping 14 matching lines...) Expand all Loading... |
605 | 625 |
606 // Factory methods. | 626 // Factory methods. |
607 | 627 |
608 Statement* EmptyStatement() { | 628 Statement* EmptyStatement() { |
609 static v8::internal::EmptyStatement empty; | 629 static v8::internal::EmptyStatement empty; |
610 return ∅ | 630 return ∅ |
611 } | 631 } |
612 | 632 |
613 Scope* NewScope(Scope* parent, Scope::Type type, bool inside_with); | 633 Scope* NewScope(Scope* parent, Scope::Type type, bool inside_with); |
614 | 634 |
615 Handle<String> LookupSymbol(int symbol_id, | 635 Handle<String> LookupSymbol(int symbol_id); |
616 Vector<const char> string); | |
617 | 636 |
618 Handle<String> LookupCachedSymbol(int symbol_id, | 637 Handle<String> LookupCachedSymbol(int symbol_id); |
619 Vector<const char> string); | |
620 | 638 |
621 Expression* NewCall(Expression* expression, | 639 Expression* NewCall(Expression* expression, |
622 ZoneList<Expression*>* arguments, | 640 ZoneList<Expression*>* arguments, |
623 int pos) { | 641 int pos) { |
624 return new Call(expression, arguments, pos); | 642 return new Call(expression, arguments, pos); |
625 } | 643 } |
626 | 644 |
627 | 645 |
628 // Create a number literal. | 646 // Create a number literal. |
629 Literal* NewNumberLiteral(double value); | 647 Literal* NewNumberLiteral(double value); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 Handle<Object> ReportUnexpectedToken() { return Handle<Object>::null(); } | 767 Handle<Object> ReportUnexpectedToken() { return Handle<Object>::null(); } |
750 // Converts the currently parsed literal to a JavaScript String. | 768 // Converts the currently parsed literal to a JavaScript String. |
751 Handle<String> GetString(); | 769 Handle<String> GetString(); |
752 | 770 |
753 JsonScanner scanner_; | 771 JsonScanner scanner_; |
754 bool stack_overflow_; | 772 bool stack_overflow_; |
755 }; | 773 }; |
756 } } // namespace v8::internal | 774 } } // namespace v8::internal |
757 | 775 |
758 #endif // V8_PARSER_H_ | 776 #endif // V8_PARSER_H_ |
OLD | NEW |