| OLD | NEW |
| 1 // Copyright 2006-2008 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 public: | 274 public: |
| 275 explicit LiteralScope(Scanner* self); | 275 explicit LiteralScope(Scanner* self); |
| 276 ~LiteralScope(); | 276 ~LiteralScope(); |
| 277 void Complete(); | 277 void Complete(); |
| 278 | 278 |
| 279 private: | 279 private: |
| 280 Scanner* scanner_; | 280 Scanner* scanner_; |
| 281 bool complete_; | 281 bool complete_; |
| 282 }; | 282 }; |
| 283 | 283 |
| 284 // Construction | 284 Scanner(); |
| 285 explicit Scanner(ParserMode parse_mode); | |
| 286 | 285 |
| 287 // Initialize the Scanner to scan source. | 286 // Initialize the Scanner to scan source. |
| 288 void Initialize(Handle<String> source, | 287 void Initialize(Handle<String> source, |
| 289 ParserLanguage language); | 288 ParserLanguage language); |
| 290 void Initialize(Handle<String> source, | 289 void Initialize(Handle<String> source, |
| 291 unibrow::CharacterStream* stream, | 290 unibrow::CharacterStream* stream, |
| 292 ParserLanguage language); | 291 ParserLanguage language); |
| 293 void Initialize(Handle<String> source, | 292 void Initialize(Handle<String> source, |
| 294 int start_position, int end_position, | 293 int start_position, int end_position, |
| 295 ParserLanguage language); | 294 ParserLanguage language); |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 return source_->pos() - kCharacterLookaheadBufferSize; | 480 return source_->pos() - kCharacterLookaheadBufferSize; |
| 482 } | 481 } |
| 483 | 482 |
| 484 // Decodes a unicode escape-sequence which is part of an identifier. | 483 // Decodes a unicode escape-sequence which is part of an identifier. |
| 485 // If the escape sequence cannot be decoded the result is kBadRune. | 484 // If the escape sequence cannot be decoded the result is kBadRune. |
| 486 uc32 ScanIdentifierUnicodeEscape(); | 485 uc32 ScanIdentifierUnicodeEscape(); |
| 487 | 486 |
| 488 TokenDesc current_; // desc for current token (as returned by Next()) | 487 TokenDesc current_; // desc for current token (as returned by Next()) |
| 489 TokenDesc next_; // desc for next token (one token look-ahead) | 488 TokenDesc next_; // desc for next token (one token look-ahead) |
| 490 bool has_line_terminator_before_next_; | 489 bool has_line_terminator_before_next_; |
| 491 bool is_pre_parsing_; | |
| 492 bool is_parsing_json_; | 490 bool is_parsing_json_; |
| 493 | 491 |
| 494 // Different UTF16 buffers used to pull characters from. Based on input one of | 492 // Different UTF16 buffers used to pull characters from. Based on input one of |
| 495 // these will be initialized as the actual data source. | 493 // these will be initialized as the actual data source. |
| 496 CharacterStreamUTF16Buffer char_stream_buffer_; | 494 CharacterStreamUTF16Buffer char_stream_buffer_; |
| 497 ExternalStringUTF16Buffer<ExternalTwoByteString, uint16_t> | 495 ExternalStringUTF16Buffer<ExternalTwoByteString, uint16_t> |
| 498 two_byte_string_buffer_; | 496 two_byte_string_buffer_; |
| 499 ExternalStringUTF16Buffer<ExternalAsciiString, char> ascii_string_buffer_; | 497 ExternalStringUTF16Buffer<ExternalAsciiString, char> ascii_string_buffer_; |
| 500 | 498 |
| 501 // Source. Will point to one of the buffers declared above. | 499 // Source. Will point to one of the buffers declared above. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 512 bool stack_overflow_; | 510 bool stack_overflow_; |
| 513 static StaticResource<Utf8Decoder> utf8_decoder_; | 511 static StaticResource<Utf8Decoder> utf8_decoder_; |
| 514 | 512 |
| 515 // One Unicode character look-ahead; c0_ < 0 at the end of the input. | 513 // One Unicode character look-ahead; c0_ < 0 at the end of the input. |
| 516 uc32 c0_; | 514 uc32 c0_; |
| 517 }; | 515 }; |
| 518 | 516 |
| 519 } } // namespace v8::internal | 517 } } // namespace v8::internal |
| 520 | 518 |
| 521 #endif // V8_SCANNER_H_ | 519 #endif // V8_SCANNER_H_ |
| OLD | NEW |