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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 class LiteralBuffer { | 162 class LiteralBuffer { |
163 public: | 163 public: |
164 LiteralBuffer() : is_ascii_(true), position_(0), backing_store_() { } | 164 LiteralBuffer() : is_ascii_(true), position_(0), backing_store_() { } |
165 | 165 |
166 ~LiteralBuffer() { | 166 ~LiteralBuffer() { |
167 if (backing_store_.length() > 0) { | 167 if (backing_store_.length() > 0) { |
168 backing_store_.Dispose(); | 168 backing_store_.Dispose(); |
169 } | 169 } |
170 } | 170 } |
171 | 171 |
172 inline void AddChar(uc16 character) { | 172 INLINE(void AddChar(uc16 character)) { |
173 if (position_ >= backing_store_.length()) ExpandBuffer(); | 173 if (position_ >= backing_store_.length()) ExpandBuffer(); |
174 if (is_ascii_) { | 174 if (is_ascii_) { |
175 if (character < kMaxAsciiCharCodeU) { | 175 if (character < kMaxAsciiCharCodeU) { |
176 backing_store_[position_] = static_cast<byte>(character); | 176 backing_store_[position_] = static_cast<byte>(character); |
177 position_ += kASCIISize; | 177 position_ += kASCIISize; |
178 return; | 178 return; |
179 } | 179 } |
180 ConvertToUC16(); | 180 ConvertToUC16(); |
181 } | 181 } |
182 *reinterpret_cast<uc16*>(&backing_store_[position_]) = character; | 182 *reinterpret_cast<uc16*>(&backing_store_[position_]) = character; |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 } | 382 } |
383 | 383 |
384 // Literal buffer support | 384 // Literal buffer support |
385 inline void StartLiteral() { | 385 inline void StartLiteral() { |
386 LiteralBuffer* free_buffer = (current_.literal_chars == &literal_buffer1_) ? | 386 LiteralBuffer* free_buffer = (current_.literal_chars == &literal_buffer1_) ? |
387 &literal_buffer2_ : &literal_buffer1_; | 387 &literal_buffer2_ : &literal_buffer1_; |
388 free_buffer->Reset(); | 388 free_buffer->Reset(); |
389 next_.literal_chars = free_buffer; | 389 next_.literal_chars = free_buffer; |
390 } | 390 } |
391 | 391 |
392 inline void AddLiteralChar(uc32 c) { | 392 INLINE(void AddLiteralChar(uc32 c)) { |
393 ASSERT_NOT_NULL(next_.literal_chars); | 393 ASSERT_NOT_NULL(next_.literal_chars); |
394 next_.literal_chars->AddChar(c); | 394 next_.literal_chars->AddChar(c); |
395 } | 395 } |
396 | 396 |
397 // Complete scanning of a literal. | 397 // Complete scanning of a literal. |
398 inline void TerminateLiteral() { | 398 inline void TerminateLiteral() { |
399 // Does nothing in the current implementation. | 399 // Does nothing in the current implementation. |
400 } | 400 } |
401 | 401 |
402 // Stops scanning of a literal and drop the collected characters, | 402 // Stops scanning of a literal and drop the collected characters, |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 // line-terminator after the current token, and before the next. | 566 // line-terminator after the current token, and before the next. |
567 bool has_multiline_comment_before_next_; | 567 bool has_multiline_comment_before_next_; |
568 // Whether we scan 'let' as a keyword for harmony block scoped | 568 // Whether we scan 'let' as a keyword for harmony block scoped |
569 // let bindings. | 569 // let bindings. |
570 bool harmony_scoping_; | 570 bool harmony_scoping_; |
571 }; | 571 }; |
572 | 572 |
573 } } // namespace v8::internal | 573 } } // namespace v8::internal |
574 | 574 |
575 #endif // V8_SCANNER_H_ | 575 #endif // V8_SCANNER_H_ |
OLD | NEW |