aboutsummaryrefslogtreecommitdiff
path: root/src/dateparser.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/dateparser.h')
-rw-r--r--src/dateparser.h29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/dateparser.h b/src/dateparser.h
index cae9b08d..40e56f30 100644
--- a/src/dateparser.h
+++ b/src/dateparser.h
@@ -28,7 +28,8 @@
#ifndef V8_DATEPARSER_H_
#define V8_DATEPARSER_H_
-#include "scanner.h"
+#include "char-predicates-inl.h"
+#include "scanner-base.h"
namespace v8 {
namespace internal {
@@ -86,6 +87,18 @@ class DateParser : public AllStatic {
return n;
}
+ // Read a string of digits, take the first three or fewer as an unsigned
+ // number of milliseconds, and ignore any digits after the first three.
+ int ReadMilliseconds() {
+ has_read_number_ = true;
+ int n = 0;
+ int power;
+ for (power = 100; IsAsciiDigit(); Next(), power = power / 10) {
+ n = n + power * (ch_ - '0');
+ }
+ return n;
+ }
+
// Read a word (sequence of chars. >= 'A'), fill the given buffer with a
// lower-case prefix, and pad any remainder of the buffer with zeroes.
// Return word length.
@@ -99,10 +112,20 @@ class DateParser : public AllStatic {
}
// The skip methods return whether they actually skipped something.
- bool Skip(uint32_t c) { return ch_ == c ? (Next(), true) : false; }
+ bool Skip(uint32_t c) {
+ if (ch_ == c) {
+ Next();
+ return true;
+ }
+ return false;
+ }
bool SkipWhiteSpace() {
- return Scanner::kIsWhiteSpace.get(ch_) ? (Next(), true) : false;
+ if (ScannerConstants::kIsWhiteSpace.get(ch_)) {
+ Next();
+ return true;
+ }
+ return false;
}
bool SkipParentheses() {