| 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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 } | 342 } |
| 343 Vector<const uc16> next_literal_uc16_string() { | 343 Vector<const uc16> next_literal_uc16_string() { |
| 344 ASSERT_NOT_NULL(next_.literal_chars); | 344 ASSERT_NOT_NULL(next_.literal_chars); |
| 345 return next_.literal_chars->uc16_literal(); | 345 return next_.literal_chars->uc16_literal(); |
| 346 } | 346 } |
| 347 int next_literal_length() const { | 347 int next_literal_length() const { |
| 348 ASSERT_NOT_NULL(next_.literal_chars); | 348 ASSERT_NOT_NULL(next_.literal_chars); |
| 349 return next_.literal_chars->length(); | 349 return next_.literal_chars->length(); |
| 350 } | 350 } |
| 351 | 351 |
| 352 UnicodeCache* unicode_cache() { return unicode_cache_; } |
| 353 |
| 352 static const int kCharacterLookaheadBufferSize = 1; | 354 static const int kCharacterLookaheadBufferSize = 1; |
| 353 | 355 |
| 354 protected: | 356 protected: |
| 355 // The current and look-ahead token. | 357 // The current and look-ahead token. |
| 356 struct TokenDesc { | 358 struct TokenDesc { |
| 357 Token::Value token; | 359 Token::Value token; |
| 358 Location location; | 360 Location location; |
| 359 LiteralBuffer* literal_chars; | 361 LiteralBuffer* literal_chars; |
| 360 }; | 362 }; |
| 361 | 363 |
| 362 // Call this after setting source_ to the input. | 364 // Call this after setting source_ to the input. |
| 363 void Init() { | 365 void Init() { |
| 364 // Set c0_ (one character ahead) | 366 // Set c0_ (one character ahead) |
| 365 ASSERT(kCharacterLookaheadBufferSize == 1); | 367 STATIC_ASSERT(kCharacterLookaheadBufferSize == 1); |
| 366 Advance(); | 368 Advance(); |
| 367 // Initialize current_ to not refer to a literal. | 369 // Initialize current_ to not refer to a literal. |
| 368 current_.literal_chars = NULL; | 370 current_.literal_chars = NULL; |
| 369 } | 371 } |
| 370 | 372 |
| 371 // Literal buffer support | 373 // Literal buffer support |
| 372 inline void StartLiteral() { | 374 inline void StartLiteral() { |
| 373 LiteralBuffer* free_buffer = (current_.literal_chars == &literal_buffer1_) ? | 375 LiteralBuffer* free_buffer = (current_.literal_chars == &literal_buffer1_) ? |
| 374 &literal_buffer2_ : &literal_buffer1_; | 376 &literal_buffer2_ : &literal_buffer1_; |
| 375 free_buffer->Reset(); | 377 free_buffer->Reset(); |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 // line-terminator after the current token, and before the next. | 555 // line-terminator after the current token, and before the next. |
| 554 bool has_multiline_comment_before_next_; | 556 bool has_multiline_comment_before_next_; |
| 555 // Whether we scan 'let' as a keyword for harmony block scoped | 557 // Whether we scan 'let' as a keyword for harmony block scoped |
| 556 // let bindings. | 558 // let bindings. |
| 557 bool harmony_block_scoping_; | 559 bool harmony_block_scoping_; |
| 558 }; | 560 }; |
| 559 | 561 |
| 560 } } // namespace v8::internal | 562 } } // namespace v8::internal |
| 561 | 563 |
| 562 #endif // V8_SCANNER_BASE_H_ | 564 #endif // V8_SCANNER_BASE_H_ |
| OLD | NEW |