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 1407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1418 | 1418 |
1419 double Scanner::DoubleValue() { | 1419 double Scanner::DoubleValue() { |
1420 DCHECK(is_literal_one_byte()); | 1420 DCHECK(is_literal_one_byte()); |
1421 return StringToDouble( | 1421 return StringToDouble( |
1422 unicode_cache_, | 1422 unicode_cache_, |
1423 literal_one_byte_string(), | 1423 literal_one_byte_string(), |
1424 ALLOW_HEX | ALLOW_OCTAL | ALLOW_IMPLICIT_OCTAL | ALLOW_BINARY); | 1424 ALLOW_HEX | ALLOW_OCTAL | ALLOW_IMPLICIT_OCTAL | ALLOW_BINARY); |
1425 } | 1425 } |
1426 | 1426 |
1427 | 1427 |
| 1428 bool Scanner::ContainsDot() { |
| 1429 DCHECK(is_literal_one_byte()); |
| 1430 Vector<const uint8_t> str = literal_one_byte_string(); |
| 1431 return std::find(str.begin(), str.end(), '.') != str.end(); |
| 1432 } |
| 1433 |
| 1434 |
1428 int Scanner::FindSymbol(DuplicateFinder* finder, int value) { | 1435 int Scanner::FindSymbol(DuplicateFinder* finder, int value) { |
1429 if (is_literal_one_byte()) { | 1436 if (is_literal_one_byte()) { |
1430 return finder->AddOneByteSymbol(literal_one_byte_string(), value); | 1437 return finder->AddOneByteSymbol(literal_one_byte_string(), value); |
1431 } | 1438 } |
1432 return finder->AddTwoByteSymbol(literal_two_byte_string(), value); | 1439 return finder->AddTwoByteSymbol(literal_two_byte_string(), value); |
1433 } | 1440 } |
1434 | 1441 |
1435 | 1442 |
1436 bool Scanner::SetBookmark() { | 1443 bool Scanner::SetBookmark() { |
1437 if (c0_ != kNoBookmark && bookmark_c0_ == kNoBookmark && | 1444 if (c0_ != kNoBookmark && bookmark_c0_ == kNoBookmark && |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1617 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u)); | 1624 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u)); |
1618 } | 1625 } |
1619 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f)); | 1626 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f)); |
1620 | 1627 |
1621 backing_store_.AddBlock(bytes); | 1628 backing_store_.AddBlock(bytes); |
1622 return backing_store_.EndSequence().start(); | 1629 return backing_store_.EndSequence().start(); |
1623 } | 1630 } |
1624 | 1631 |
1625 } // namespace internal | 1632 } // namespace internal |
1626 } // namespace v8 | 1633 } // namespace v8 |
OLD | NEW |