OLD | NEW |
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // Read a string of digits as an unsigned number (cap just below kMaxInt). | 80 // Read a string of digits as an unsigned number (cap just below kMaxInt). |
81 int ReadUnsignedNumber() { | 81 int ReadUnsignedNumber() { |
82 has_read_number_ = true; | 82 has_read_number_ = true; |
83 int n; | 83 int n; |
84 for (n = 0; IsAsciiDigit() && n < kMaxInt / 10 - 1; Next()) { | 84 for (n = 0; IsAsciiDigit() && n < kMaxInt / 10 - 1; Next()) { |
85 n = n * 10 + ch_ - '0'; | 85 n = n * 10 + ch_ - '0'; |
86 } | 86 } |
87 return n; | 87 return n; |
88 } | 88 } |
89 | 89 |
| 90 // Read a string of digits, take the first three or fewer as an unsigned |
| 91 // number of milliseconds, and ignore any digits after the first three. |
| 92 int ReadMilliseconds() { |
| 93 has_read_number_ = true; |
| 94 int n = 0; |
| 95 int power; |
| 96 for (power = 100; IsAsciiDigit(); Next(), power = power / 10) { |
| 97 n = n + power * (ch_ - '0'); |
| 98 } |
| 99 return n; |
| 100 } |
| 101 |
90 // Read a word (sequence of chars. >= 'A'), fill the given buffer with a | 102 // Read a word (sequence of chars. >= 'A'), fill the given buffer with a |
91 // lower-case prefix, and pad any remainder of the buffer with zeroes. | 103 // lower-case prefix, and pad any remainder of the buffer with zeroes. |
92 // Return word length. | 104 // Return word length. |
93 int ReadWord(uint32_t* prefix, int prefix_size) { | 105 int ReadWord(uint32_t* prefix, int prefix_size) { |
94 int len; | 106 int len; |
95 for (len = 0; IsAsciiAlphaOrAbove(); Next(), len++) { | 107 for (len = 0; IsAsciiAlphaOrAbove(); Next(), len++) { |
96 if (len < prefix_size) prefix[len] = AsciiAlphaToLower(ch_); | 108 if (len < prefix_size) prefix[len] = AsciiAlphaToLower(ch_); |
97 } | 109 } |
98 for (int i = len; i < prefix_size; i++) prefix[i] = 0; | 110 for (int i = len; i < prefix_size; i++) prefix[i] = 0; |
99 return len; | 111 return len; |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 int comp_[kSize]; | 254 int comp_[kSize]; |
243 int index_; | 255 int index_; |
244 int named_month_; | 256 int named_month_; |
245 }; | 257 }; |
246 }; | 258 }; |
247 | 259 |
248 | 260 |
249 } } // namespace v8::internal | 261 } } // namespace v8::internal |
250 | 262 |
251 #endif // V8_DATEPARSER_H_ | 263 #endif // V8_DATEPARSER_H_ |
OLD | NEW |