Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(914)

Side by Side Diff: src/scanner.cc

Issue 1201783003: Allow numeric literals to be checked for a decimal point. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: iteration... Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1415 matching lines...) Expand 10 before | Expand all | Expand 10 after
1426 1426
1427 double Scanner::DoubleValue() { 1427 double Scanner::DoubleValue() {
1428 DCHECK(is_literal_one_byte()); 1428 DCHECK(is_literal_one_byte());
1429 return StringToDouble( 1429 return StringToDouble(
1430 unicode_cache_, 1430 unicode_cache_,
1431 literal_one_byte_string(), 1431 literal_one_byte_string(),
1432 ALLOW_HEX | ALLOW_OCTAL | ALLOW_IMPLICIT_OCTAL | ALLOW_BINARY); 1432 ALLOW_HEX | ALLOW_OCTAL | ALLOW_IMPLICIT_OCTAL | ALLOW_BINARY);
1433 } 1433 }
1434 1434
1435 1435
1436 bool Scanner::ContainsDot() {
1437 DCHECK(is_literal_one_byte());
1438 Vector<const uint8_t> str = literal_one_byte_string();
1439 return std::find(str.begin(), str.end(), '.') != str.end();
1440 }
1441
1442
1436 int Scanner::FindSymbol(DuplicateFinder* finder, int value) { 1443 int Scanner::FindSymbol(DuplicateFinder* finder, int value) {
1437 if (is_literal_one_byte()) { 1444 if (is_literal_one_byte()) {
1438 return finder->AddOneByteSymbol(literal_one_byte_string(), value); 1445 return finder->AddOneByteSymbol(literal_one_byte_string(), value);
1439 } 1446 }
1440 return finder->AddTwoByteSymbol(literal_two_byte_string(), value); 1447 return finder->AddTwoByteSymbol(literal_two_byte_string(), value);
1441 } 1448 }
1442 1449
1443 1450
1444 bool Scanner::SetBookmark() { 1451 bool Scanner::SetBookmark() {
1445 if (c0_ != kNoBookmark && bookmark_c0_ == kNoBookmark && 1452 if (c0_ != kNoBookmark && bookmark_c0_ == kNoBookmark &&
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
1625 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u)); 1632 backing_store_.Add(static_cast<uint8_t>((one_byte_length >> 7) | 0x80u));
1626 } 1633 }
1627 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f)); 1634 backing_store_.Add(static_cast<uint8_t>(one_byte_length & 0x7f));
1628 1635
1629 backing_store_.AddBlock(bytes); 1636 backing_store_.AddBlock(bytes);
1630 return backing_store_.EndSequence().start(); 1637 return backing_store_.EndSequence().start();
1631 } 1638 }
1632 1639
1633 } // namespace internal 1640 } // namespace internal
1634 } // namespace v8 1641 } // namespace v8
OLDNEW
« no previous file with comments | « src/scanner.h ('k') | test/cctest/test-parsing.cc » ('j') | test/cctest/test-parsing.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698