| 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 1406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1417 | 1417 |
| 1418 const AstRawString* Scanner::CurrentRawSymbol( | 1418 const AstRawString* Scanner::CurrentRawSymbol( |
| 1419 AstValueFactory* ast_value_factory) { | 1419 AstValueFactory* ast_value_factory) { |
| 1420 if (is_raw_literal_one_byte()) { | 1420 if (is_raw_literal_one_byte()) { |
| 1421 return ast_value_factory->GetOneByteString(raw_literal_one_byte_string()); | 1421 return ast_value_factory->GetOneByteString(raw_literal_one_byte_string()); |
| 1422 } | 1422 } |
| 1423 return ast_value_factory->GetTwoByteString(raw_literal_two_byte_string()); | 1423 return ast_value_factory->GetTwoByteString(raw_literal_two_byte_string()); |
| 1424 } | 1424 } |
| 1425 | 1425 |
| 1426 | 1426 |
| 1427 bool Scanner::IsFloat() { |
| 1428 Vector<const uint8_t> literal_string = literal_one_byte_string(); |
| 1429 for (int i = 0; i < literal_string.length(); ++i) { |
| 1430 if (literal_string[i] == '.') |
| 1431 return true; |
| 1432 } |
| 1433 return false; |
| 1434 } |
| 1435 |
| 1436 |
| 1427 double Scanner::DoubleValue() { | 1437 double Scanner::DoubleValue() { |
| 1428 DCHECK(is_literal_one_byte()); | 1438 DCHECK(is_literal_one_byte()); |
| 1429 return StringToDouble( | 1439 return StringToDouble( |
| 1430 unicode_cache_, | 1440 unicode_cache_, |
| 1431 literal_one_byte_string(), | 1441 literal_one_byte_string(), |
| 1432 ALLOW_HEX | ALLOW_OCTAL | ALLOW_IMPLICIT_OCTAL | ALLOW_BINARY); | 1442 ALLOW_HEX | ALLOW_OCTAL | ALLOW_IMPLICIT_OCTAL | ALLOW_BINARY); |
| 1433 } | 1443 } |
| 1434 | 1444 |
| 1435 | 1445 |
| 1436 int Scanner::FindSymbol(DuplicateFinder* finder, int value) { | 1446 int Scanner::FindSymbol(DuplicateFinder* finder, int value) { |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1625 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u)); | 1635 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u)); |
| 1626 } | 1636 } |
| 1627 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f)); | 1637 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f)); |
| 1628 | 1638 |
| 1629 backing_store_.AddBlock(bytes); | 1639 backing_store_.AddBlock(bytes); |
| 1630 return backing_store_.EndSequence().start(); | 1640 return backing_store_.EndSequence().start(); |
| 1631 } | 1641 } |
| 1632 | 1642 |
| 1633 } // namespace internal | 1643 } // namespace internal |
| 1634 } // namespace v8 | 1644 } // namespace v8 |
| OLD | NEW |