Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(424)

Side by Side Diff: src/dateparser-inl.h

Issue 3318017: make Date.parse properly handle TZ offsets... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-857.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 } 58 }
59 } else if (in.Skip('.') && time.IsExpecting(n)) { 59 } else if (in.Skip('.') && time.IsExpecting(n)) {
60 time.Add(n); 60 time.Add(n);
61 if (!in.IsAsciiDigit()) return false; 61 if (!in.IsAsciiDigit()) return false;
62 int n = in.ReadUnsignedNumber(); 62 int n = in.ReadUnsignedNumber();
63 time.AddFinal(n); 63 time.AddFinal(n);
64 } else if (tz.IsExpecting(n)) { 64 } else if (tz.IsExpecting(n)) {
65 tz.SetAbsoluteMinute(n); 65 tz.SetAbsoluteMinute(n);
66 } else if (time.IsExpecting(n)) { 66 } else if (time.IsExpecting(n)) {
67 time.AddFinal(n); 67 time.AddFinal(n);
68 // Require end, white space or Z immediately after finalizing time. 68 // Require end, white space, "Z", "+" or "-" immediately after
69 if (!in.IsEnd() && !in.SkipWhiteSpace() && !in.Is('Z')) return false; 69 // finalizing time.
70 if (!in.IsEnd() && !in.SkipWhiteSpace() && !in.Is('Z') &&
71 !in.IsAsciiSign()) return false;
70 } else { 72 } else {
71 if (!day.Add(n)) return false; 73 if (!day.Add(n)) return false;
72 in.Skip('-'); // Ignore suffix '-' for year, month, or day. 74 in.Skip('-'); // Ignore suffix '-' for year, month, or day.
73 // Skip trailing 'T' for ECMAScript 5 date string format but make 75 // Skip trailing 'T' for ECMAScript 5 date string format but make
74 // sure that it is followed by a digit (for the time). 76 // sure that it is followed by a digit (for the time).
75 if (in.Skip('T') && !in.IsAsciiDigit()) return false; 77 if (in.Skip('T') && !in.IsAsciiDigit()) return false;
76 } 78 }
77 } else if (in.IsAsciiAlphaOrAbove()) { 79 } else if (in.IsAsciiAlphaOrAbove()) {
78 // Parse a "word" (sequence of chars. >= 'A'). 80 // Parse a "word" (sequence of chars. >= 'A').
79 uint32_t pre[KeywordTable::kPrefixLength]; 81 uint32_t pre[KeywordTable::kPrefixLength];
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // Ignore other characters. 116 // Ignore other characters.
115 in.Next(); 117 in.Next();
116 } 118 }
117 } 119 }
118 return day.Write(out) && time.Write(out) && tz.Write(out); 120 return day.Write(out) && time.Write(out) && tz.Write(out);
119 } 121 }
120 122
121 } } // namespace v8::internal 123 } } // namespace v8::internal
122 124
123 #endif // V8_DATEPARSER_INL_H_ 125 #endif // V8_DATEPARSER_INL_H_
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-857.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698