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