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 <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "scanner.h" | 9 #include "scanner.h" |
10 | 10 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 Token::RBRACE, // 0x7d | 202 Token::RBRACE, // 0x7d |
203 Token::BIT_NOT, // 0x7e | 203 Token::BIT_NOT, // 0x7e |
204 Token::ILLEGAL | 204 Token::ILLEGAL |
205 }; | 205 }; |
206 | 206 |
207 | 207 |
208 Token::Value Scanner::Next() { | 208 Token::Value Scanner::Next() { |
209 current_ = next_; | 209 current_ = next_; |
210 has_line_terminator_before_next_ = false; | 210 has_line_terminator_before_next_ = false; |
211 has_multiline_comment_before_next_ = false; | 211 has_multiline_comment_before_next_ = false; |
| 212 param_list_finder_.Update(current_.token, current_.location.beg_pos); |
212 if (static_cast<unsigned>(c0_) <= 0x7f) { | 213 if (static_cast<unsigned>(c0_) <= 0x7f) { |
213 Token::Value token = static_cast<Token::Value>(one_char_tokens[c0_]); | 214 Token::Value token = static_cast<Token::Value>(one_char_tokens[c0_]); |
214 if (token != Token::ILLEGAL) { | 215 if (token != Token::ILLEGAL) { |
215 int pos = source_pos(); | 216 int pos = source_pos(); |
216 next_.token = token; | 217 next_.token = token; |
217 next_.location.beg_pos = pos; | 218 next_.location.beg_pos = pos; |
218 next_.location.end_pos = pos + 1; | 219 next_.location.end_pos = pos + 1; |
219 Advance(); | 220 Advance(); |
220 return current_.token; | 221 return current_.token; |
221 } | 222 } |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 token = Select('=', Token::ASSIGN_SHR, Token::SHR); | 388 token = Select('=', Token::ASSIGN_SHR, Token::SHR); |
388 } else { | 389 } else { |
389 token = Token::SAR; | 390 token = Token::SAR; |
390 } | 391 } |
391 } else { | 392 } else { |
392 token = Token::GT; | 393 token = Token::GT; |
393 } | 394 } |
394 break; | 395 break; |
395 | 396 |
396 case '=': | 397 case '=': |
397 // = == === | 398 // = == === => |
398 Advance(); | 399 Advance(); |
399 if (c0_ == '=') { | 400 if (c0_ == '=') { |
400 token = Select('=', Token::EQ_STRICT, Token::EQ); | 401 token = Select('=', Token::EQ_STRICT, Token::EQ); |
| 402 } else if (c0_ == '>') { |
| 403 token = Select(Token::ARROW); |
401 } else { | 404 } else { |
402 token = Token::ASSIGN; | 405 token = Token::ASSIGN; |
403 } | 406 } |
404 break; | 407 break; |
405 | 408 |
406 case '!': | 409 case '!': |
407 // ! != !== | 410 // ! != !== |
408 Advance(); | 411 Advance(); |
409 if (c0_ == '=') { | 412 if (c0_ == '=') { |
410 token = Select('=', Token::NE_STRICT, Token::NE); | 413 token = Select('=', Token::NE_STRICT, Token::NE); |
(...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1271 } | 1274 } |
1272 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u)); | 1275 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u)); |
1273 } | 1276 } |
1274 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f)); | 1277 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f)); |
1275 | 1278 |
1276 backing_store_.AddBlock(bytes); | 1279 backing_store_.AddBlock(bytes); |
1277 return backing_store_.EndSequence().start(); | 1280 return backing_store_.EndSequence().start(); |
1278 } | 1281 } |
1279 | 1282 |
1280 } } // namespace v8::internal | 1283 } } // namespace v8::internal |
OLD | NEW |