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

Unified 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: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/scanner.h ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scanner.cc
diff --git a/src/scanner.cc b/src/scanner.cc
index a2ca30a9be5df0b08eede51835eb506ff78752a1..55a3ab181ad01eb12a8c697d4da24d1bcd90444a 100644
--- a/src/scanner.cc
+++ b/src/scanner.cc
@@ -1433,6 +1433,17 @@ double Scanner::DoubleValue() {
}
+bool Scanner::ContainsDot() {
Sven Panne 2015/06/22 07:53:43 Instead of using caveman-style loops, the right wa
bradn 2015/06/23 06:54:07 Turns out Vector<> provides begin/end, which allow
+ DCHECK(is_literal_one_byte());
+ Vector<const uint8_t> literal_string = literal_one_byte_string();
titzer 2015/06/22 07:08:16 Does this make a copy of the bytes underneath?
bradn 2015/06/23 06:54:07 No, it copies a reference to the underying buffer
+ bool with_dot = false;
+ for (int i = 0; !with_dot && i < literal_string.length(); ++i) {
+ with_dot |= (literal_string[i] == '.');
titzer 2015/06/22 07:08:16 Early return?
bradn 2015/06/23 06:54:07 Replaced. FWIW was lifted wholesale from a prototy
+ }
+ return with_dot;
+}
+
+
int Scanner::FindSymbol(DuplicateFinder* finder, int value) {
if (is_literal_one_byte()) {
return finder->AddOneByteSymbol(literal_one_byte_string(), value);
« no previous file with comments | « src/scanner.h ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698