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

Unified Diff: runtime/vm/scanner.cc

Issue 11316031: - Move MathNatives from dart:core to dart:math. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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
Index: runtime/vm/scanner.cc
===================================================================
--- runtime/vm/scanner.cc (revision 14972)
+++ runtime/vm/scanner.cc (working copy)
@@ -174,6 +174,36 @@
}
+// TODO(srdjan): Investigate for performance hit; the integer and double parsing
+// may not be efficient as we need to generate two extra growable arrays.
siva 2012/11/16 01:34:26 This comment here does not seem to make sense?
Ivan Posva 2012/11/16 19:26:43 Adjusted comment explaining what this method is fo
+bool Scanner::IsValidLiteral(const Scanner::GrowableTokenStream& tokens,
+ Token::Kind literal_kind,
Mads Ager (google) 2012/11/16 05:46:21 Indentation is slightly off.
Ivan Posva 2012/11/16 19:26:43 Done.
+ bool* is_positive,
+ String** value) {
+ if ((tokens.length() == 2) &&
+ (tokens[0].kind == literal_kind) &&
+ (tokens[1].kind == Token::kEOS)) {
+ *is_positive = true;
+ *value = tokens[0].literal;
+ return true;
+ }
+ if ((tokens.length() == 3) &&
+ ((tokens[0].kind == Token::kTIGHTADD) ||
+ (tokens[0].kind == Token::kSUB)) &&
Mads Ager (google) 2012/11/16 05:46:21 Indentation sligthly off.
Ivan Posva 2012/11/16 19:26:43 Done.
+ (tokens[1].kind == literal_kind) &&
+ (tokens[2].kind == Token::kEOS)) {
+ // Check there is no space between "+/-" and number.
+ if ((tokens[0].offset + 1) != tokens[1].offset) {
+ return false;
+ }
+ *is_positive = tokens[0].kind == Token::kTIGHTADD;
+ *value = tokens[1].literal;
+ return true;
+ }
+ return false;
+}
+
+
void Scanner::ReadChar() {
if (lookahead_pos_ < source_length_) {
if (c0_ == '\n') {
« runtime/lib/integers.cc ('K') | « runtime/vm/scanner.h ('k') | runtime/vm/vm.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698