Chromium Code Reviews| Index: src/dateparser.cc |
| diff --git a/src/dateparser.cc b/src/dateparser.cc |
| index 4b64785bb2d01b46297ceae64dbbbbb312c13cf4..29eb7ac58c55003fa999fc716d7f3a398e31b20c 100644 |
| --- a/src/dateparser.cc |
| +++ b/src/dateparser.cc |
| @@ -31,84 +31,6 @@ |
| namespace v8 { namespace internal { |
| - |
| -bool DateParser::Parse(String* str, FixedArray* out) { |
| - ASSERT(out->length() == OUTPUT_SIZE); |
| - |
| - InputReader in(str); |
| - TimeZoneComposer tz; |
| - TimeComposer time; |
| - DayComposer day; |
| - |
| - while (!in.IsEnd()) { |
| - if (in.IsAsciiDigit()) { |
| - // Parse a number (possibly with 1 or 2 trailing colons). |
| - int n = in.ReadUnsignedNumber(); |
| - if (in.Skip(':')) { |
| - if (in.Skip(':')) { |
| - // n + "::" |
| - if (!time.IsEmpty()) return false; |
| - time.Add(n); |
| - time.Add(0); |
| - } else { |
| - // n + ":" |
| - if (!time.Add(n)) return false; |
| - } |
| - } else if (tz.IsExpecting(n)) { |
| - tz.SetAbsoluteMinute(n); |
| - } else if (time.IsExpecting(n)) { |
| - time.AddFinal(n); |
| - // Require end or white space immediately after finalizing time. |
| - if (!in.IsEnd() && !in.SkipWhiteSpace()) return false; |
| - } else { |
| - if (!day.Add(n)) return false; |
| - in.Skip('-'); // Ignore suffix '-' for year, month, or day. |
| - } |
| - } else if (in.IsAsciiAlphaOrAbove()) { |
| - // Parse a "word" (sequence of chars. >= 'A'). |
| - uint32_t pre[KeywordTable::kPrefixLength]; |
| - int len = in.ReadWord(pre, KeywordTable::kPrefixLength); |
| - int index = KeywordTable::Lookup(pre, len); |
| - KeywordType type = KeywordTable::GetType(index); |
| - |
| - if (type == AM_PM && !time.IsEmpty()) { |
| - time.SetHourOffset(KeywordTable::GetValue(index)); |
| - } else if (type == MONTH_NAME) { |
| - day.SetNamedMonth(KeywordTable::GetValue(index)); |
| - in.Skip('-'); // Ignore suffix '-' for month names |
| - } else if (type == TIME_ZONE_NAME && in.HasReadNumber()) { |
| - tz.Set(KeywordTable::GetValue(index)); |
| - } else { |
| - // Garbage words are illegal if no number read yet. |
| - if (in.HasReadNumber()) return false; |
| - } |
| - } else if (in.IsAsciiSign() && (tz.IsUTC() || !time.IsEmpty())) { |
| - // Parse UTC offset (only after UTC or time). |
| - tz.SetSign(in.GetAsciiSignValue()); |
| - in.Next(); |
| - int n = in.ReadUnsignedNumber(); |
| - if (in.Skip(':')) { |
| - tz.SetAbsoluteHour(n); |
| - tz.SetAbsoluteMinute(kNone); |
| - } else { |
| - tz.SetAbsoluteHour(n / 100); |
| - tz.SetAbsoluteMinute(n % 100); |
| - } |
| - } else if (in.Is('(')) { |
| - // Ignore anything from '(' to a matching ')' or end of string. |
| - in.SkipParentheses(); |
| - } else if ((in.IsAsciiSign() || in.Is(')')) && in.HasReadNumber()) { |
| - // Extra sign or ')' is illegal if no number read yet. |
| - return false; |
| - } else { |
| - // Ignore other characters. |
| - in.Next(); |
| - } |
| - } |
| - return day.Write(out) && time.Write(out) && tz.Write(out); |
| -} |
| - |
| - |
| bool DateParser::DayComposer::Write(FixedArray* output) { |
| int year = 0; // Default year is 0 (=> 2000) for KJS compatibility. |
| int month = kNone; |
| @@ -161,7 +83,6 @@ bool DateParser::DayComposer::Write(FixedArray* output) { |
| return true; |
| } |
|
Erik Corry
2009/03/17 13:09:01
There should be two blank lines between methods.
|
| - |
| bool DateParser::TimeComposer::Write(FixedArray* output) { |
| // All time slots default to 0 |
| while (index_ < kSize) { |
| @@ -192,7 +113,6 @@ bool DateParser::TimeComposer::Write(FixedArray* output) { |
| return true; |
| } |
| - |
| bool DateParser::TimeZoneComposer::Write(FixedArray* output) { |
| if (sign_ != kNone) { |
| if (hour_ == kNone) hour_ = 0; |
| @@ -210,9 +130,8 @@ bool DateParser::TimeZoneComposer::Write(FixedArray* output) { |
| return true; |
| } |
| - |
| -const int8_t |
| -DateParser::KeywordTable::array[][DateParser::KeywordTable::kEntrySize] = { |
| +const int8_t DateParser::KeywordTable:: |
| + array[][DateParser::KeywordTable::kEntrySize] = { |
| {'j', 'a', 'n', DateParser::MONTH_NAME, 1}, |
| {'f', 'e', 'b', DateParser::MONTH_NAME, 2}, |
| {'m', 'a', 'r', DateParser::MONTH_NAME, 3}, |