| 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 "src/v8.h" | 9 #include "src/v8.h" |
| 10 | 10 |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 token = Select('=', Token::ASSIGN_SHR, Token::SHR); | 388 token = Select('=', Token::ASSIGN_SHR, Token::SHR); |
| 389 } else { | 389 } else { |
| 390 token = Token::SAR; | 390 token = Token::SAR; |
| 391 } | 391 } |
| 392 } else { | 392 } else { |
| 393 token = Token::GT; | 393 token = Token::GT; |
| 394 } | 394 } |
| 395 break; | 395 break; |
| 396 | 396 |
| 397 case '=': | 397 case '=': |
| 398 // = == === | 398 // = == === => |
| 399 Advance(); | 399 Advance(); |
| 400 if (c0_ == '=') { | 400 if (c0_ == '=') { |
| 401 token = Select('=', Token::EQ_STRICT, Token::EQ); | 401 token = Select('=', Token::EQ_STRICT, Token::EQ); |
| 402 } else if (c0_ == '>') { |
| 403 token = Select(Token::ARROW); |
| 402 } else { | 404 } else { |
| 403 token = Token::ASSIGN; | 405 token = Token::ASSIGN; |
| 404 } | 406 } |
| 405 break; | 407 break; |
| 406 | 408 |
| 407 case '!': | 409 case '!': |
| 408 // ! != !== | 410 // ! != !== |
| 409 Advance(); | 411 Advance(); |
| 410 if (c0_ == '=') { | 412 if (c0_ == '=') { |
| 411 token = Select('=', Token::NE_STRICT, Token::NE); | 413 token = Select('=', Token::NE_STRICT, Token::NE); |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 921 (keyword_length <= 9 || input[9] == keyword[9])) { \ | 923 (keyword_length <= 9 || input[9] == keyword[9])) { \ |
| 922 return token; \ | 924 return token; \ |
| 923 } \ | 925 } \ |
| 924 } | 926 } |
| 925 KEYWORDS(KEYWORD_GROUP_CASE, KEYWORD) | 927 KEYWORDS(KEYWORD_GROUP_CASE, KEYWORD) |
| 926 } | 928 } |
| 927 return Token::IDENTIFIER; | 929 return Token::IDENTIFIER; |
| 928 } | 930 } |
| 929 | 931 |
| 930 | 932 |
| 933 bool Scanner::IdentifierIsFutureStrictReserved( |
| 934 const AstRawString* string) const { |
| 935 // Keywords are always 1-byte strings. |
| 936 return string->is_one_byte() && |
| 937 Token::FUTURE_STRICT_RESERVED_WORD == KeywordOrIdentifierToken( |
| 938 string->raw_data(), string->length(), |
| 939 harmony_scoping_, harmony_modules_); |
| 940 } |
| 941 |
| 942 |
| 931 Token::Value Scanner::ScanIdentifierOrKeyword() { | 943 Token::Value Scanner::ScanIdentifierOrKeyword() { |
| 932 ASSERT(unicode_cache_->IsIdentifierStart(c0_)); | 944 ASSERT(unicode_cache_->IsIdentifierStart(c0_)); |
| 933 LiteralScope literal(this); | 945 LiteralScope literal(this); |
| 934 // Scan identifier start character. | 946 // Scan identifier start character. |
| 935 if (c0_ == '\\') { | 947 if (c0_ == '\\') { |
| 936 uc32 c = ScanIdentifierUnicodeEscape(); | 948 uc32 c = ScanIdentifierUnicodeEscape(); |
| 937 // Only allow legal identifier start characters. | 949 // Only allow legal identifier start characters. |
| 938 if (c < 0 || | 950 if (c < 0 || |
| 939 c == '\\' || // No recursive escapes. | 951 c == '\\' || // No recursive escapes. |
| 940 !unicode_cache_->IsIdentifierStart(c)) { | 952 !unicode_cache_->IsIdentifierStart(c)) { |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1265 } | 1277 } |
| 1266 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u)); | 1278 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u)); |
| 1267 } | 1279 } |
| 1268 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f)); | 1280 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f)); |
| 1269 | 1281 |
| 1270 backing_store_.AddBlock(bytes); | 1282 backing_store_.AddBlock(bytes); |
| 1271 return backing_store_.EndSequence().start(); | 1283 return backing_store_.EndSequence().start(); |
| 1272 } | 1284 } |
| 1273 | 1285 |
| 1274 } } // namespace v8::internal | 1286 } } // namespace v8::internal |
| OLD | NEW |