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

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

Issue 1287893006: Separate UnicodeCache out into an own file. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « src/dateparser.h ('k') | src/objects.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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_DATEPARSER_INL_H_ 5 #ifndef V8_DATEPARSER_INL_H_
6 #define V8_DATEPARSER_INL_H_ 6 #define V8_DATEPARSER_INL_H_
7 7
8 #include "src/char-predicates-inl.h" 8 #include "src/char-predicates-inl.h"
9 #include "src/dateparser.h" 9 #include "src/dateparser.h"
10 #include "src/unicode-cache-inl.h"
10 11
11 namespace v8 { 12 namespace v8 {
12 namespace internal { 13 namespace internal {
13 14
14 template <typename Char> 15 template <typename Char>
15 bool DateParser::Parse(Vector<Char> str, 16 bool DateParser::Parse(Vector<Char> str,
16 FixedArray* out, 17 FixedArray* out,
17 UnicodeCache* unicode_cache) { 18 UnicodeCache* unicode_cache) {
18 DCHECK(out->length() >= OUTPUT_SIZE); 19 DCHECK(out->length() >= OUTPUT_SIZE);
19 InputReader<Char> in(unicode_cache, str); 20 InputReader<Char> in(unicode_cache, str);
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 } 187 }
187 if (in_->SkipParentheses()) { 188 if (in_->SkipParentheses()) {
188 return DateToken::Unknown(); 189 return DateToken::Unknown();
189 } 190 }
190 in_->Next(); 191 in_->Next();
191 return DateToken::Unknown(); 192 return DateToken::Unknown();
192 } 193 }
193 194
194 195
195 template <typename Char> 196 template <typename Char>
197 bool DateParser::InputReader<Char>::SkipWhiteSpace() {
198 if (unicode_cache_->IsWhiteSpaceOrLineTerminator(ch_)) {
199 Next();
200 return true;
201 }
202 return false;
203 }
204
205
206 template <typename Char>
207 bool DateParser::InputReader<Char>::SkipParentheses() {
208 if (ch_ != '(') return false;
209 int balance = 0;
210 do {
211 if (ch_ == ')') --balance;
212 else if (ch_ == '(') ++balance;
213 Next();
214 } while (balance > 0 && ch_);
215 return true;
216 }
217
218
219 template <typename Char>
196 DateParser::DateToken DateParser::ParseES6DateTime( 220 DateParser::DateToken DateParser::ParseES6DateTime(
197 DateStringTokenizer<Char>* scanner, 221 DateStringTokenizer<Char>* scanner,
198 DayComposer* day, 222 DayComposer* day,
199 TimeComposer* time, 223 TimeComposer* time,
200 TimeZoneComposer* tz) { 224 TimeZoneComposer* tz) {
201 DCHECK(day->IsEmpty()); 225 DCHECK(day->IsEmpty());
202 DCHECK(time->IsEmpty()); 226 DCHECK(time->IsEmpty());
203 DCHECK(tz->IsEmpty()); 227 DCHECK(tz->IsEmpty());
204 228
205 // Parse mandatory date string: [('-'|'+')yy]yyyy[':'MM[':'DD]] 229 // Parse mandatory date string: [('-'|'+')yy]yyyy[':'MM[':'DD]]
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 } 323 }
300 // Successfully parsed ES6 Date Time String. 324 // Successfully parsed ES6 Date Time String.
301 day->set_iso_date(); 325 day->set_iso_date();
302 return DateToken::EndOfInput(); 326 return DateToken::EndOfInput();
303 } 327 }
304 328
305 329
306 } } // namespace v8::internal 330 } } // namespace v8::internal
307 331
308 #endif // V8_DATEPARSER_INL_H_ 332 #endif // V8_DATEPARSER_INL_H_
OLDNEW
« no previous file with comments | « src/dateparser.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698