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_PREPARSER_H | 5 #ifndef V8_PREPARSER_H |
6 #define V8_PREPARSER_H | 6 #define V8_PREPARSER_H |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 bool peek_any_identifier() { | 337 bool peek_any_identifier() { |
338 Token::Value next = peek(); | 338 Token::Value next = peek(); |
339 return next == Token::IDENTIFIER || | 339 return next == Token::IDENTIFIER || |
340 next == Token::FUTURE_RESERVED_WORD || | 340 next == Token::FUTURE_RESERVED_WORD || |
341 next == Token::FUTURE_STRICT_RESERVED_WORD || | 341 next == Token::FUTURE_STRICT_RESERVED_WORD || |
342 next == Token::LET || | 342 next == Token::LET || |
343 next == Token::YIELD; | 343 next == Token::YIELD; |
344 } | 344 } |
345 | 345 |
346 bool CheckContextualKeyword(Vector<const char> keyword) { | 346 bool CheckContextualKeyword(Vector<const char> keyword) { |
347 if (PeekContextualKeyword(keyword)) { | 347 if (peek() == Token::IDENTIFIER && |
| 348 scanner()->is_next_contextual_keyword(keyword)) { |
348 Consume(Token::IDENTIFIER); | 349 Consume(Token::IDENTIFIER); |
349 return true; | 350 return true; |
350 } | 351 } |
351 return false; | 352 return false; |
352 } | 353 } |
353 | 354 |
354 bool PeekContextualKeyword(Vector<const char> keyword) { | |
355 return peek() == Token::IDENTIFIER && | |
356 scanner()->is_next_contextual_keyword(keyword); | |
357 } | |
358 | |
359 void ExpectContextualKeyword(Vector<const char> keyword, bool* ok) { | 355 void ExpectContextualKeyword(Vector<const char> keyword, bool* ok) { |
360 Expect(Token::IDENTIFIER, ok); | 356 Expect(Token::IDENTIFIER, ok); |
361 if (!*ok) return; | 357 if (!*ok) return; |
362 if (!scanner()->is_literal_contextual_keyword(keyword)) { | 358 if (!scanner()->is_literal_contextual_keyword(keyword)) { |
363 ReportUnexpectedToken(scanner()->current_token()); | 359 ReportUnexpectedToken(scanner()->current_token()); |
364 *ok = false; | 360 *ok = false; |
365 } | 361 } |
366 } | 362 } |
367 | 363 |
368 // Checks whether an octal literal was last seen between beg_pos and end_pos. | 364 // Checks whether an octal literal was last seen between beg_pos and end_pos. |
(...skipping 2462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2831 DCHECK(IsAccessorAccessorConflict(old_type, type)); | 2827 DCHECK(IsAccessorAccessorConflict(old_type, type)); |
2832 // Both accessors of the same type. | 2828 // Both accessors of the same type. |
2833 parser()->ReportMessage("accessor_get_set"); | 2829 parser()->ReportMessage("accessor_get_set"); |
2834 } | 2830 } |
2835 *ok = false; | 2831 *ok = false; |
2836 } | 2832 } |
2837 } | 2833 } |
2838 } } // v8::internal | 2834 } } // v8::internal |
2839 | 2835 |
2840 #endif // V8_PREPARSER_H | 2836 #endif // V8_PREPARSER_H |
OLD | NEW |