| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 // Features shared by parsing and pre-parsing scanners. | 5 // Features shared by parsing and pre-parsing scanners. |
| 6 | 6 |
| 7 #ifndef V8_PARSING_SCANNER_H_ | 7 #ifndef V8_PARSING_SCANNER_H_ |
| 8 #define V8_PARSING_SCANNER_H_ | 8 #define V8_PARSING_SCANNER_H_ |
| 9 | 9 |
| 10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 void clear_octal_position() { octal_pos_ = Location::invalid(); } | 277 void clear_octal_position() { octal_pos_ = Location::invalid(); } |
| 278 // Returns the location of the last seen decimal literal with a leading zero. | 278 // Returns the location of the last seen decimal literal with a leading zero. |
| 279 Location decimal_with_leading_zero_position() const { | 279 Location decimal_with_leading_zero_position() const { |
| 280 return decimal_with_leading_zero_pos_; | 280 return decimal_with_leading_zero_pos_; |
| 281 } | 281 } |
| 282 void clear_decimal_with_leading_zero_position() { | 282 void clear_decimal_with_leading_zero_position() { |
| 283 decimal_with_leading_zero_pos_ = Location::invalid(); | 283 decimal_with_leading_zero_pos_ = Location::invalid(); |
| 284 } | 284 } |
| 285 | 285 |
| 286 // Returns the value of the last smi that was scanned. | 286 // Returns the value of the last smi that was scanned. |
| 287 int smi_value() const { return current_.smi_value_; } | 287 uint32_t smi_value() const { return current_.smi_value_; } |
| 288 | 288 |
| 289 // Seek forward to the given position. This operation does not | 289 // Seek forward to the given position. This operation does not |
| 290 // work in general, for instance when there are pushed back | 290 // work in general, for instance when there are pushed back |
| 291 // characters, but works for seeking forward until simple delimiter | 291 // characters, but works for seeking forward until simple delimiter |
| 292 // tokens, which is what it is used for. | 292 // tokens, which is what it is used for. |
| 293 void SeekForward(int pos); | 293 void SeekForward(int pos); |
| 294 | 294 |
| 295 // Returns true if there was a line terminator before the peek'ed token, | 295 // Returns true if there was a line terminator before the peek'ed token, |
| 296 // possibly inside a multi-line comment. | 296 // possibly inside a multi-line comment. |
| 297 bool HasAnyLineTerminatorBeforeNext() const { | 297 bool HasAnyLineTerminatorBeforeNext() const { |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 Vector<byte> backing_store_; | 480 Vector<byte> backing_store_; |
| 481 | 481 |
| 482 DISALLOW_COPY_AND_ASSIGN(LiteralBuffer); | 482 DISALLOW_COPY_AND_ASSIGN(LiteralBuffer); |
| 483 }; | 483 }; |
| 484 | 484 |
| 485 // The current and look-ahead token. | 485 // The current and look-ahead token. |
| 486 struct TokenDesc { | 486 struct TokenDesc { |
| 487 Location location; | 487 Location location; |
| 488 LiteralBuffer* literal_chars; | 488 LiteralBuffer* literal_chars; |
| 489 LiteralBuffer* raw_literal_chars; | 489 LiteralBuffer* raw_literal_chars; |
| 490 int smi_value_; | 490 uint32_t smi_value_; |
| 491 Token::Value token; | 491 Token::Value token; |
| 492 }; | 492 }; |
| 493 | 493 |
| 494 static const int kCharacterLookaheadBufferSize = 1; | 494 static const int kCharacterLookaheadBufferSize = 1; |
| 495 const int kMaxAscii = 127; | 495 const int kMaxAscii = 127; |
| 496 | 496 |
| 497 // Scans octal escape sequence. Also accepts "\0" decimal escape sequence. | 497 // Scans octal escape sequence. Also accepts "\0" decimal escape sequence. |
| 498 template <bool capture_raw> | 498 template <bool capture_raw> |
| 499 uc32 ScanOctalEscape(uc32 c, int length); | 499 uc32 ScanOctalEscape(uc32 c, int length); |
| 500 | 500 |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 bool found_html_comment_; | 804 bool found_html_comment_; |
| 805 | 805 |
| 806 MessageTemplate::Template scanner_error_; | 806 MessageTemplate::Template scanner_error_; |
| 807 Location scanner_error_location_; | 807 Location scanner_error_location_; |
| 808 }; | 808 }; |
| 809 | 809 |
| 810 } // namespace internal | 810 } // namespace internal |
| 811 } // namespace v8 | 811 } // namespace v8 |
| 812 | 812 |
| 813 #endif // V8_PARSING_SCANNER_H_ | 813 #endif // V8_PARSING_SCANNER_H_ |
| OLD | NEW |