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

Unified Diff: runtime/vm/scanner.cc

Issue 2005723004: Fraction class prototype and test (not to be committed). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: work in progress Created 4 years, 5 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 | « runtime/vm/raw_object_snapshot.cc ('k') | runtime/vm/snapshot.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/scanner.cc
diff --git a/runtime/vm/scanner.cc b/runtime/vm/scanner.cc
index f7ae4ac59525fca9ca450cce9d6fa356af548dbb..b88770842084d71c2a3f0d0a33784e4f55a66e45 100644
--- a/runtime/vm/scanner.cc
+++ b/runtime/vm/scanner.cc
@@ -344,9 +344,10 @@ void Scanner::ScanIdentChars(bool allow_dollar) {
}
-// Parse integer or double number literal of format:
-// NUMBER = INTEGER | DOUBLE
+// Parse integer, rational, or double number literal of format:
+// NUMBER = INTEGER | RATIONAL | DOUBLE
// INTEGER = D+ | (("0x" | "0X") H+)
+// RATIONAL = ((D+ ["." D*]) | ("." D+)) ("r" | "R")
// DOUBLE = ((D+ ["." D*]) | ("." D+)) [ EXPONENT ]
// EXPONENT = ("e" | "E") ["+" | "-"] D+
void Scanner::ScanNumber(bool dec_point_seen) {
@@ -388,6 +389,8 @@ void Scanner::ScanNumber(bool dec_point_seen) {
while (IsDecimalDigit(c0_)) {
ReadChar();
}
+ } else if ((c0_ == 'r') || (c0_ == 'R')) {
+ Recognize(Token::kRATIONAL);
}
}
if (current_token_.kind != Token::kILLEGAL) {
« no previous file with comments | « runtime/vm/raw_object_snapshot.cc ('k') | runtime/vm/snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698