| OLD | NEW |
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 #ifndef V8_DATEPARSER_INL_H_ | 28 #ifndef V8_DATEPARSER_INL_H_ |
| 29 #define V8_DATEPARSER_INL_H_ | 29 #define V8_DATEPARSER_INL_H_ |
| 30 | 30 |
| 31 #include "dateparser.h" | 31 #include "dateparser.h" |
| 32 | 32 |
| 33 namespace v8 { | 33 namespace v8 { |
| 34 namespace internal { | 34 namespace internal { |
| 35 | 35 |
| 36 template <typename Char> | 36 template <typename Char> |
| 37 bool DateParser::Parse(Vector<Char> str, FixedArray* out) { | 37 bool DateParser::Parse(Vector<Char> str, |
| 38 FixedArray* out, |
| 39 UnicodeCache* unicode_cache) { |
| 38 ASSERT(out->length() >= OUTPUT_SIZE); | 40 ASSERT(out->length() >= OUTPUT_SIZE); |
| 39 InputReader<Char> in(str); | 41 InputReader<Char> in(unicode_cache, str); |
| 40 TimeZoneComposer tz; | 42 TimeZoneComposer tz; |
| 41 TimeComposer time; | 43 TimeComposer time; |
| 42 DayComposer day; | 44 DayComposer day; |
| 43 | 45 |
| 44 while (!in.IsEnd()) { | 46 while (!in.IsEnd()) { |
| 45 if (in.IsAsciiDigit()) { | 47 if (in.IsAsciiDigit()) { |
| 46 // Parse a number (possibly with 1 or 2 trailing colons). | 48 // Parse a number (possibly with 1 or 2 trailing colons). |
| 47 int n = in.ReadUnsignedNumber(); | 49 int n = in.ReadUnsignedNumber(); |
| 48 if (in.Skip(':')) { | 50 if (in.Skip(':')) { |
| 49 if (in.Skip(':')) { | 51 if (in.Skip(':')) { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 // Ignore other characters. | 118 // Ignore other characters. |
| 117 in.Next(); | 119 in.Next(); |
| 118 } | 120 } |
| 119 } | 121 } |
| 120 return day.Write(out) && time.Write(out) && tz.Write(out); | 122 return day.Write(out) && time.Write(out) && tz.Write(out); |
| 121 } | 123 } |
| 122 | 124 |
| 123 } } // namespace v8::internal | 125 } } // namespace v8::internal |
| 124 | 126 |
| 125 #endif // V8_DATEPARSER_INL_H_ | 127 #endif // V8_DATEPARSER_INL_H_ |
| OLD | NEW |