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

Side by Side Diff: src/dateparser.h

Issue 7754022: Fix presubmit errors caused by updated depot tools (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 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 | « src/d8-posix.cc ('k') | src/debug.h » ('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 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 18 matching lines...) Expand all
29 #define V8_DATEPARSER_H_ 29 #define V8_DATEPARSER_H_
30 30
31 #include "allocation.h" 31 #include "allocation.h"
32 #include "char-predicates-inl.h" 32 #include "char-predicates-inl.h"
33 33
34 namespace v8 { 34 namespace v8 {
35 namespace internal { 35 namespace internal {
36 36
37 class DateParser : public AllStatic { 37 class DateParser : public AllStatic {
38 public: 38 public:
39
40 // Parse the string as a date. If parsing succeeds, return true after 39 // Parse the string as a date. If parsing succeeds, return true after
41 // filling out the output array as follows (all integers are Smis): 40 // filling out the output array as follows (all integers are Smis):
42 // [0]: year 41 // [0]: year
43 // [1]: month (0 = Jan, 1 = Feb, ...) 42 // [1]: month (0 = Jan, 1 = Feb, ...)
44 // [2]: day 43 // [2]: day
45 // [3]: hour 44 // [3]: hour
46 // [4]: minute 45 // [4]: minute
47 // [5]: second 46 // [5]: second
48 // [6]: millisecond 47 // [6]: millisecond
49 // [7]: UTC offset in seconds, or null value if no timezone specified 48 // [7]: UTC offset in seconds, or null value if no timezone specified
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 } 226 }
228 static DateToken WhiteSpace(int length) { 227 static DateToken WhiteSpace(int length) {
229 return DateToken(kWhiteSpaceTag, length, -1); 228 return DateToken(kWhiteSpaceTag, length, -1);
230 } 229 }
231 static DateToken Unknown() { 230 static DateToken Unknown() {
232 return DateToken(kUnknownTokenTag, 1, -1); 231 return DateToken(kUnknownTokenTag, 1, -1);
233 } 232 }
234 static DateToken Invalid() { 233 static DateToken Invalid() {
235 return DateToken(kInvalidTokenTag, 0, -1); 234 return DateToken(kInvalidTokenTag, 0, -1);
236 } 235 }
236
237 private: 237 private:
238 enum TagType { 238 enum TagType {
239 kInvalidTokenTag = -6, 239 kInvalidTokenTag = -6,
240 kUnknownTokenTag = -5, 240 kUnknownTokenTag = -5,
241 kWhiteSpaceTag = -4, 241 kWhiteSpaceTag = -4,
242 kNumberTag = -3, 242 kNumberTag = -3,
243 kSymbolTag = -2, 243 kSymbolTag = -2,
244 kEndOfInputTag = -1, 244 kEndOfInputTag = -1,
245 kKeywordTagStart = 0 245 kKeywordTagStart = 0
246 }; 246 };
(...skipping 21 matching lines...) Expand all
268 DateToken Peek() { 268 DateToken Peek() {
269 return next_; 269 return next_;
270 } 270 }
271 bool SkipSymbol(char symbol) { 271 bool SkipSymbol(char symbol) {
272 if (next_.IsSymbol(symbol)) { 272 if (next_.IsSymbol(symbol)) {
273 next_ = Scan(); 273 next_ = Scan();
274 return true; 274 return true;
275 } 275 }
276 return false; 276 return false;
277 } 277 }
278
278 private: 279 private:
279 DateToken Scan(); 280 DateToken Scan();
280 281
281 InputReader<Char>* in_; 282 InputReader<Char>* in_;
282 DateToken next_; 283 DateToken next_;
283 }; 284 };
284 285
285 static int ReadMilliseconds(DateToken number); 286 static int ReadMilliseconds(DateToken number);
286 287
287 // KeywordTable maps names of months, time zones, am/pm to numbers. 288 // KeywordTable maps names of months, time zones, am/pm to numbers.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 if (!Add(n)) return false; 345 if (!Add(n)) return false;
345 while (index_ < kSize) comp_[index_++] = 0; 346 while (index_ < kSize) comp_[index_++] = 0;
346 return true; 347 return true;
347 } 348 }
348 void SetHourOffset(int n) { hour_offset_ = n; } 349 void SetHourOffset(int n) { hour_offset_ = n; }
349 bool Write(FixedArray* output); 350 bool Write(FixedArray* output);
350 351
351 static bool IsMinute(int x) { return Between(x, 0, 59); } 352 static bool IsMinute(int x) { return Between(x, 0, 59); }
352 static bool IsHour(int x) { return Between(x, 0, 23); } 353 static bool IsHour(int x) { return Between(x, 0, 23); }
353 static bool IsSecond(int x) { return Between(x, 0, 59); } 354 static bool IsSecond(int x) { return Between(x, 0, 59); }
355
354 private: 356 private:
355 static bool IsHour12(int x) { return Between(x, 0, 12); } 357 static bool IsHour12(int x) { return Between(x, 0, 12); }
356 static bool IsMillisecond(int x) { return Between(x, 0, 999); } 358 static bool IsMillisecond(int x) { return Between(x, 0, 999); }
357 359
358 static const int kSize = 4; 360 static const int kSize = 4;
359 int comp_[kSize]; 361 int comp_[kSize];
360 int index_; 362 int index_;
361 int hour_offset_; 363 int hour_offset_;
362 }; 364 };
363 365
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 DateStringTokenizer<Char>* scanner, 400 DateStringTokenizer<Char>* scanner,
399 DayComposer* day, 401 DayComposer* day,
400 TimeComposer* time, 402 TimeComposer* time,
401 TimeZoneComposer* tz); 403 TimeZoneComposer* tz);
402 }; 404 };
403 405
404 406
405 } } // namespace v8::internal 407 } } // namespace v8::internal
406 408
407 #endif // V8_DATEPARSER_H_ 409 #endif // V8_DATEPARSER_H_
OLDNEW
« no previous file with comments | « src/d8-posix.cc ('k') | src/debug.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698