| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_PARSING_PARSER_BASE_H | 5 #ifndef V8_PARSING_PARSER_BASE_H |
| 6 #define V8_PARSING_PARSER_BASE_H | 6 #define V8_PARSING_PARSER_BASE_H |
| 7 | 7 |
| 8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
| 9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
| 10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
| (...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 // Dummy functions, just useful as arguments to CHECK_OK_CUSTOM. | 804 // Dummy functions, just useful as arguments to CHECK_OK_CUSTOM. |
| 805 static void Void() {} | 805 static void Void() {} |
| 806 template <typename T> | 806 template <typename T> |
| 807 static T Return(T result) { | 807 static T Return(T result) { |
| 808 return result; | 808 return result; |
| 809 } | 809 } |
| 810 | 810 |
| 811 bool is_any_identifier(Token::Value token) { | 811 bool is_any_identifier(Token::Value token) { |
| 812 return token == Token::IDENTIFIER || token == Token::ENUM || | 812 return token == Token::IDENTIFIER || token == Token::ENUM || |
| 813 token == Token::AWAIT || token == Token::ASYNC || | 813 token == Token::AWAIT || token == Token::ASYNC || |
| 814 token == Token::ESCAPED_STRICT_RESERVED_WORD || |
| 814 token == Token::FUTURE_STRICT_RESERVED_WORD || token == Token::LET || | 815 token == Token::FUTURE_STRICT_RESERVED_WORD || token == Token::LET || |
| 815 token == Token::STATIC || token == Token::YIELD; | 816 token == Token::STATIC || token == Token::YIELD; |
| 816 } | 817 } |
| 817 bool peek_any_identifier() { return is_any_identifier(peek()); } | 818 bool peek_any_identifier() { return is_any_identifier(peek()); } |
| 818 | 819 |
| 819 bool CheckContextualKeyword(Vector<const char> keyword) { | 820 bool CheckContextualKeyword(Vector<const char> keyword) { |
| 820 if (PeekContextualKeyword(keyword)) { | 821 if (PeekContextualKeyword(keyword)) { |
| 821 Consume(Token::IDENTIFIER); | 822 Consume(Token::IDENTIFIER); |
| 822 return true; | 823 return true; |
| 823 } | 824 } |
| (...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1674 | 1675 |
| 1675 template <class Impl> | 1676 template <class Impl> |
| 1676 typename ParserBase<Impl>::IdentifierT | 1677 typename ParserBase<Impl>::IdentifierT |
| 1677 ParserBase<Impl>::ParseIdentifierOrStrictReservedWord( | 1678 ParserBase<Impl>::ParseIdentifierOrStrictReservedWord( |
| 1678 FunctionKind function_kind, bool* is_strict_reserved, bool* ok) { | 1679 FunctionKind function_kind, bool* is_strict_reserved, bool* ok) { |
| 1679 Token::Value next = Next(); | 1680 Token::Value next = Next(); |
| 1680 if (next == Token::IDENTIFIER || (next == Token::AWAIT && !parsing_module_ && | 1681 if (next == Token::IDENTIFIER || (next == Token::AWAIT && !parsing_module_ && |
| 1681 !IsAsyncFunction(function_kind)) || | 1682 !IsAsyncFunction(function_kind)) || |
| 1682 next == Token::ASYNC) { | 1683 next == Token::ASYNC) { |
| 1683 *is_strict_reserved = false; | 1684 *is_strict_reserved = false; |
| 1684 } else if (next == Token::FUTURE_STRICT_RESERVED_WORD || next == Token::LET || | 1685 } else if (next == Token::ESCAPED_STRICT_RESERVED_WORD || |
| 1686 next == Token::FUTURE_STRICT_RESERVED_WORD || next == Token::LET || |
| 1685 next == Token::STATIC || | 1687 next == Token::STATIC || |
| 1686 (next == Token::YIELD && !IsGeneratorFunction(function_kind))) { | 1688 (next == Token::YIELD && !IsGeneratorFunction(function_kind))) { |
| 1687 *is_strict_reserved = true; | 1689 *is_strict_reserved = true; |
| 1688 } else { | 1690 } else { |
| 1689 ReportUnexpectedToken(next); | 1691 ReportUnexpectedToken(next); |
| 1690 *ok = false; | 1692 *ok = false; |
| 1691 return impl()->EmptyIdentifier(); | 1693 return impl()->EmptyIdentifier(); |
| 1692 } | 1694 } |
| 1693 | 1695 |
| 1694 return impl()->GetSymbol(); | 1696 return impl()->GetSymbol(); |
| (...skipping 4062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5757 } | 5759 } |
| 5758 | 5760 |
| 5759 #undef CHECK_OK | 5761 #undef CHECK_OK |
| 5760 #undef CHECK_OK_CUSTOM | 5762 #undef CHECK_OK_CUSTOM |
| 5761 #undef CHECK_OK_VOID | 5763 #undef CHECK_OK_VOID |
| 5762 | 5764 |
| 5763 } // namespace internal | 5765 } // namespace internal |
| 5764 } // namespace v8 | 5766 } // namespace v8 |
| 5765 | 5767 |
| 5766 #endif // V8_PARSING_PARSER_BASE_H | 5768 #endif // V8_PARSING_PARSER_BASE_H |
| OLD | NEW |