5 #ifndef V8_DATEPARSER_H_
6 #define V8_DATEPARSER_H_
27 template <
typename Char>
37 return static_cast<unsigned>(x -
lo) <=
static_cast<unsigned>(
hi -
lo);
48 template <
typename Char>
54 unicode_cache_(unicode_cache) {
62 ch_ = (index_ < buffer_.length()) ? buffer_[index_] : 0;
72 while (IsAsciiDigit()) {
85 for (len = 0; IsAsciiAlphaOrAbove(); Next(), len++) {
88 for (
int i = len;
i < prefix_size;
i++) prefix[
i] = 0;
102 if (unicode_cache_->IsWhiteSpaceOrLineTerminator(ch_)) {
110 if (ch_ !=
'(')
return false;
113 if (ch_ ==
')') --balance;
114 else if (ch_ ==
'(') ++balance;
116 }
while (balance > 0 && ch_);
122 bool IsEnd()
const {
return ch_ == 0; }
167 return static_cast<char>(
value_);
234 template <
typename Char>
289 void Set(
int offset_in_hours) {
290 sign_ = offset_in_hours < 0 ? -1 : 1;
291 hour_ = offset_in_hours * sign_;
298 return hour_ !=
kNone && minute_ ==
kNone && TimeComposer::IsMinute(n);
300 bool IsUTC()
const {
return hour_ == 0 && minute_ == 0; }
314 return (index_ == 1 && IsMinute(n)) ||
315 (index_ == 2 && IsSecond(n)) ||
316 (index_ == 3 && IsMillisecond(n));
319 return index_ < kSize ? (comp_[index_++] = n,
true) :
false;
322 if (!Add(n))
return false;
323 while (index_ < kSize) comp_[index_++] = 0;
337 static const int kSize = 4;
348 if (index_ < kSize) {
362 static const int kSize = 3;
375 template <
typename Char>
380 TimeZoneComposer* tz);
void Set(int offset_in_hours)
void SetAbsoluteMinute(int minute)
int ReadWord(uint32_t *prefix, int prefix_size)
bool IsAsciiAlphaOrAbove() const
static bool IsSecond(int x)
static bool IsMillisecond(int x)
bool IsAsciiDigit() const
static bool IsHour(int x)
static bool IsHour12(int x)
bool Write(FixedArray *output)
bool Is(uint32_t c) const
InputReader(UnicodeCache *unicode_cache, Vector< Char > s)
void SetHourOffset(int n)
static bool IsMonth(int x)
UnicodeCache * unicode_cache_
static bool IsMinute(int x)
int ReadUnsignedNumeral()
int GetAsciiSignValue() const
bool IsExpecting(int n) const
void SetNamedMonth(int n)
void SetAbsoluteHour(int hour)
DateStringTokenizer(InputReader< Char > *in)
bool SkipSymbol(char symbol)
InputReader< Char > * in_
static const int kPrefixLength
static int Lookup(const uint32_t *pre, int len)
static const int kValueOffset
static int GetValue(int i)
static KeywordType GetType(int i)
static const int kEntrySize
static const int kTypeOffset
static const int8_t array[][kEntrySize]
static bool Parse(Vector< Char > str, FixedArray *output, UnicodeCache *cache)
static const int kMaxSignificantDigits
static DateParser::DateToken ParseES5DateTime(DateStringTokenizer< Char > *scanner, DayComposer *day, TimeComposer *time, TimeZoneComposer *tz)
static bool Between(int x, int lo, int hi)
static int ReadMilliseconds(DateToken number)
#define DCHECK(condition)
bool IsDecimalDigit(uc32 c)
int AsciiAlphaToLower(uc32 c)
Debugger support for the V8 JavaScript engine.
bool IsFixedLengthNumber(int length)
static DateToken Unknown()
static DateToken Symbol(char symbol)
static DateToken Number(int value, int length)
bool IsUnknown(int character)
static DateToken Invalid()
bool IsKeywordType(KeywordType tag)
static DateToken EndOfInput()
static DateToken Keyword(KeywordType tag, int value, int length)
DateToken(int tag, int length, int value)
bool IsSymbol(char symbol)
static DateToken WhiteSpace(int length)
KeywordType keyword_type()