| OLD | NEW |
| 1 // Copyright 2011 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 |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 tz.SetAbsoluteMinute(n % 100); | 171 tz.SetAbsoluteMinute(n % 100); |
| 172 } | 172 } |
| 173 } else if ((token.IsAsciiSign() || token.IsSymbol(')')) && | 173 } else if ((token.IsAsciiSign() || token.IsSymbol(')')) && |
| 174 has_read_number) { | 174 has_read_number) { |
| 175 // Extra sign or ')' is illegal if a number has been read. | 175 // Extra sign or ')' is illegal if a number has been read. |
| 176 return false; | 176 return false; |
| 177 } else { | 177 } else { |
| 178 // Ignore other characters and whitespace. | 178 // Ignore other characters and whitespace. |
| 179 } | 179 } |
| 180 } | 180 } |
| 181 | 181 // Successfully parsed ES5 Date Time String. Default to UTC if no TZ given. |
| 182 if (tz.IsEmpty()) tz.Set(0); |
| 182 return day.Write(out) && time.Write(out) && tz.Write(out); | 183 return day.Write(out) && time.Write(out) && tz.Write(out); |
| 183 } | 184 } |
| 184 | 185 |
| 185 | 186 |
| 186 template<typename CharType> | 187 template<typename CharType> |
| 187 DateParser::DateToken DateParser::DateStringTokenizer<CharType>::Scan() { | 188 DateParser::DateToken DateParser::DateStringTokenizer<CharType>::Scan() { |
| 188 int pre_pos = in_->position(); | 189 int pre_pos = in_->position(); |
| 189 if (in_->IsEnd()) return DateToken::EndOfInput(); | 190 if (in_->IsEnd()) return DateToken::EndOfInput(); |
| 190 if (in_->IsAsciiDigit()) { | 191 if (in_->IsAsciiDigit()) { |
| 191 int n = in_->ReadUnsignedNumeral(); | 192 int n = in_->ReadUnsignedNumeral(); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 // Successfully parsed ES5 Date Time String. Default to UTC if no TZ given. | 326 // Successfully parsed ES5 Date Time String. Default to UTC if no TZ given. |
| 326 if (tz->IsEmpty()) tz->Set(0); | 327 if (tz->IsEmpty()) tz->Set(0); |
| 327 day->set_iso_date(); | 328 day->set_iso_date(); |
| 328 return DateToken::EndOfInput(); | 329 return DateToken::EndOfInput(); |
| 329 } | 330 } |
| 330 | 331 |
| 331 | 332 |
| 332 } } // namespace v8::internal | 333 } } // namespace v8::internal |
| 333 | 334 |
| 334 #endif // V8_DATEPARSER_INL_H_ | 335 #endif // V8_DATEPARSER_INL_H_ |
| OLD | NEW |