| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 if (type == AM_PM && !time.IsEmpty()) { | 141 if (type == AM_PM && !time.IsEmpty()) { |
| 142 time.SetHourOffset(value); | 142 time.SetHourOffset(value); |
| 143 } else if (type == MONTH_NAME) { | 143 } else if (type == MONTH_NAME) { |
| 144 day.SetNamedMonth(value); | 144 day.SetNamedMonth(value); |
| 145 scanner.SkipSymbol('-'); | 145 scanner.SkipSymbol('-'); |
| 146 } else if (type == TIME_ZONE_NAME && has_read_number) { | 146 } else if (type == TIME_ZONE_NAME && has_read_number) { |
| 147 tz.Set(value); | 147 tz.Set(value); |
| 148 } else { | 148 } else { |
| 149 // Garbage words are illegal if a number has been read. | 149 // Garbage words are illegal if a number has been read. |
| 150 if (has_read_number) return false; | 150 if (has_read_number) return false; |
| 151 // The first number has to be separated from garbage words by |
| 152 // whitespace or other separators. |
| 153 if (scanner.Peek().IsNumber()) return false; |
| 151 } | 154 } |
| 152 } else if (token.IsAsciiSign() && (tz.IsUTC() || !time.IsEmpty())) { | 155 } else if (token.IsAsciiSign() && (tz.IsUTC() || !time.IsEmpty())) { |
| 153 // Parse UTC offset (only after UTC or time). | 156 // Parse UTC offset (only after UTC or time). |
| 154 tz.SetSign(token.ascii_sign()); | 157 tz.SetSign(token.ascii_sign()); |
| 155 // The following number may be empty. | 158 // The following number may be empty. |
| 156 int n = 0; | 159 int n = 0; |
| 157 if (scanner.Peek().IsNumber()) { | 160 if (scanner.Peek().IsNumber()) { |
| 158 n = scanner.Next().number(); | 161 n = scanner.Next().number(); |
| 159 } | 162 } |
| 160 has_read_number = true; | 163 has_read_number = true; |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 // Successfully parsed ES5 Date Time String. Default to UTC if no TZ given. | 324 // Successfully parsed ES5 Date Time String. Default to UTC if no TZ given. |
| 322 if (tz->IsEmpty()) tz->Set(0); | 325 if (tz->IsEmpty()) tz->Set(0); |
| 323 day->set_iso_date(); | 326 day->set_iso_date(); |
| 324 return DateToken::EndOfInput(); | 327 return DateToken::EndOfInput(); |
| 325 } | 328 } |
| 326 | 329 |
| 327 | 330 |
| 328 } } // namespace v8::internal | 331 } } // namespace v8::internal |
| 329 | 332 |
| 330 #endif // V8_DATEPARSER_INL_H_ | 333 #endif // V8_DATEPARSER_INL_H_ |
| OLD | NEW |