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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 Token::ILLEGAL, | 218 Token::ILLEGAL, |
219 Token::LBRACE, // 0x7b | 219 Token::LBRACE, // 0x7b |
220 Token::ILLEGAL, | 220 Token::ILLEGAL, |
221 Token::RBRACE, // 0x7d | 221 Token::RBRACE, // 0x7d |
222 Token::BIT_NOT, // 0x7e | 222 Token::BIT_NOT, // 0x7e |
223 Token::ILLEGAL | 223 Token::ILLEGAL |
224 }; | 224 }; |
225 | 225 |
226 | 226 |
227 Token::Value Scanner::Next() { | 227 Token::Value Scanner::Next() { |
| 228 if (next_.token == Token::EOS) { |
| 229 next_.location.beg_pos = current_.location.beg_pos; |
| 230 next_.location.end_pos = current_.location.end_pos; |
| 231 } |
228 current_ = next_; | 232 current_ = next_; |
229 has_line_terminator_before_next_ = false; | 233 has_line_terminator_before_next_ = false; |
230 has_multiline_comment_before_next_ = false; | 234 has_multiline_comment_before_next_ = false; |
231 if (static_cast<unsigned>(c0_) <= 0x7f) { | 235 if (static_cast<unsigned>(c0_) <= 0x7f) { |
232 Token::Value token = static_cast<Token::Value>(one_char_tokens[c0_]); | 236 Token::Value token = static_cast<Token::Value>(one_char_tokens[c0_]); |
233 if (token != Token::ILLEGAL) { | 237 if (token != Token::ILLEGAL) { |
234 int pos = source_pos(); | 238 int pos = source_pos(); |
235 next_.token = token; | 239 next_.token = token; |
236 next_.location.beg_pos = pos; | 240 next_.location.beg_pos = pos; |
237 next_.location.end_pos = pos + 1; | 241 next_.location.end_pos = pos + 1; |
(...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1559 } | 1563 } |
1560 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u)); | 1564 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u)); |
1561 } | 1565 } |
1562 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f)); | 1566 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f)); |
1563 | 1567 |
1564 backing_store_.AddBlock(bytes); | 1568 backing_store_.AddBlock(bytes); |
1565 return backing_store_.EndSequence().start(); | 1569 return backing_store_.EndSequence().start(); |
1566 } | 1570 } |
1567 | 1571 |
1568 } } // namespace v8::internal | 1572 } } // namespace v8::internal |
OLD | NEW |