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 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <cmath> | 9 #include <cmath> |
10 | 10 |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 Token::ILLEGAL, | 229 Token::ILLEGAL, |
230 Token::LBRACE, // 0x7b | 230 Token::LBRACE, // 0x7b |
231 Token::ILLEGAL, | 231 Token::ILLEGAL, |
232 Token::RBRACE, // 0x7d | 232 Token::RBRACE, // 0x7d |
233 Token::BIT_NOT, // 0x7e | 233 Token::BIT_NOT, // 0x7e |
234 Token::ILLEGAL | 234 Token::ILLEGAL |
235 }; | 235 }; |
236 | 236 |
237 | 237 |
238 Token::Value Scanner::Next() { | 238 Token::Value Scanner::Next() { |
| 239 if (next_.token == Token::EOS) { |
| 240 next_.location.beg_pos = current_.location.beg_pos; |
| 241 next_.location.end_pos = current_.location.end_pos; |
| 242 } |
239 current_ = next_; | 243 current_ = next_; |
240 has_line_terminator_before_next_ = false; | 244 has_line_terminator_before_next_ = false; |
241 has_multiline_comment_before_next_ = false; | 245 has_multiline_comment_before_next_ = false; |
242 if (static_cast<unsigned>(c0_) <= 0x7f) { | 246 if (static_cast<unsigned>(c0_) <= 0x7f) { |
243 Token::Value token = static_cast<Token::Value>(one_char_tokens[c0_]); | 247 Token::Value token = static_cast<Token::Value>(one_char_tokens[c0_]); |
244 if (token != Token::ILLEGAL) { | 248 if (token != Token::ILLEGAL) { |
245 int pos = source_pos(); | 249 int pos = source_pos(); |
246 next_.token = token; | 250 next_.token = token; |
247 next_.location.beg_pos = pos; | 251 next_.location.beg_pos = pos; |
248 next_.location.end_pos = pos + 1; | 252 next_.location.end_pos = pos + 1; |
(...skipping 1371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1620 } | 1624 } |
1621 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u)); | 1625 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u)); |
1622 } | 1626 } |
1623 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f)); | 1627 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f)); |
1624 | 1628 |
1625 backing_store_.AddBlock(bytes); | 1629 backing_store_.AddBlock(bytes); |
1626 return backing_store_.EndSequence().start(); | 1630 return backing_store_.EndSequence().start(); |
1627 } | 1631 } |
1628 | 1632 |
1629 } } // namespace v8::internal | 1633 } } // namespace v8::internal |
OLD | NEW |