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 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 // Returns the location of the last seen octal literal | 500 // Returns the location of the last seen octal literal |
501 Location octal_position() const { return octal_pos_; } | 501 Location octal_position() const { return octal_pos_; } |
502 void clear_octal_position() { octal_pos_ = Location::invalid(); } | 502 void clear_octal_position() { octal_pos_ = Location::invalid(); } |
503 | 503 |
504 // Seek forward to the given position. This operation does not | 504 // Seek forward to the given position. This operation does not |
505 // work in general, for instance when there are pushed back | 505 // work in general, for instance when there are pushed back |
506 // characters, but works for seeking forward until simple delimiter | 506 // characters, but works for seeking forward until simple delimiter |
507 // tokens, which is what it is used for. | 507 // tokens, which is what it is used for. |
508 void SeekForward(int pos); | 508 void SeekForward(int pos); |
509 | 509 |
| 510 bool HarmonyBlockScoping() const { |
| 511 return harmony_block_scoping_; |
| 512 } |
| 513 void SetHarmonyBlockScoping(bool block_scoping) { |
| 514 harmony_block_scoping_ = block_scoping; |
| 515 } |
| 516 |
| 517 |
510 protected: | 518 protected: |
511 bool SkipWhiteSpace(); | 519 bool SkipWhiteSpace(); |
512 Token::Value SkipSingleLineComment(); | 520 Token::Value SkipSingleLineComment(); |
513 Token::Value SkipMultiLineComment(); | 521 Token::Value SkipMultiLineComment(); |
514 | 522 |
515 // Scans a single JavaScript token. | 523 // Scans a single JavaScript token. |
516 void Scan(); | 524 void Scan(); |
517 | 525 |
518 void ScanDecimalDigits(); | 526 void ScanDecimalDigits(); |
519 Token::Value ScanNumber(bool seen_period); | 527 Token::Value ScanNumber(bool seen_period); |
(...skipping 13 matching lines...) Expand all Loading... |
533 // Start position of the octal literal last scanned. | 541 // Start position of the octal literal last scanned. |
534 Location octal_pos_; | 542 Location octal_pos_; |
535 | 543 |
536 // Whether there is a line terminator whitespace character after | 544 // Whether there is a line terminator whitespace character after |
537 // the current token, and before the next. Does not count newlines | 545 // the current token, and before the next. Does not count newlines |
538 // inside multiline comments. | 546 // inside multiline comments. |
539 bool has_line_terminator_before_next_; | 547 bool has_line_terminator_before_next_; |
540 // Whether there is a multi-line comment that contains a | 548 // Whether there is a multi-line comment that contains a |
541 // line-terminator after the current token, and before the next. | 549 // line-terminator after the current token, and before the next. |
542 bool has_multiline_comment_before_next_; | 550 bool has_multiline_comment_before_next_; |
| 551 // Whether we scan 'let' as a keyword for harmony block scoped |
| 552 // let bindings. |
| 553 bool harmony_block_scoping_; |
543 }; | 554 }; |
544 | 555 |
545 } } // namespace v8::internal | 556 } } // namespace v8::internal |
546 | 557 |
547 #endif // V8_SCANNER_BASE_H_ | 558 #endif // V8_SCANNER_BASE_H_ |
OLD | NEW |