OLD | NEW |
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_H_ | 5 #ifndef V8_DATEPARSER_H_ |
6 #define V8_DATEPARSER_H_ | 6 #define V8_DATEPARSER_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/char-predicates.h" | 9 #include "src/char-predicates.h" |
10 #include "src/scanner.h" | 10 #include "src/scanner.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 // The skip methods return whether they actually skipped something. | 93 // The skip methods return whether they actually skipped something. |
94 bool Skip(uint32_t c) { | 94 bool Skip(uint32_t c) { |
95 if (ch_ == c) { | 95 if (ch_ == c) { |
96 Next(); | 96 Next(); |
97 return true; | 97 return true; |
98 } | 98 } |
99 return false; | 99 return false; |
100 } | 100 } |
101 | 101 |
102 bool SkipWhiteSpace() { | 102 inline bool SkipWhiteSpace(); |
103 if (unicode_cache_->IsWhiteSpaceOrLineTerminator(ch_)) { | 103 inline bool SkipParentheses(); |
104 Next(); | |
105 return true; | |
106 } | |
107 return false; | |
108 } | |
109 | |
110 bool SkipParentheses() { | |
111 if (ch_ != '(') return false; | |
112 int balance = 0; | |
113 do { | |
114 if (ch_ == ')') --balance; | |
115 else if (ch_ == '(') ++balance; | |
116 Next(); | |
117 } while (balance > 0 && ch_); | |
118 return true; | |
119 } | |
120 | 104 |
121 // Character testing/classification. Non-ASCII digits are not supported. | 105 // Character testing/classification. Non-ASCII digits are not supported. |
122 bool Is(uint32_t c) const { return ch_ == c; } | 106 bool Is(uint32_t c) const { return ch_ == c; } |
123 bool IsEnd() const { return ch_ == 0; } | 107 bool IsEnd() const { return ch_ == 0; } |
124 bool IsAsciiDigit() const { return IsDecimalDigit(ch_); } | 108 bool IsAsciiDigit() const { return IsDecimalDigit(ch_); } |
125 bool IsAsciiAlphaOrAbove() const { return ch_ >= 'A'; } | 109 bool IsAsciiAlphaOrAbove() const { return ch_ >= 'A'; } |
126 bool IsAsciiSign() const { return ch_ == '+' || ch_ == '-'; } | 110 bool IsAsciiSign() const { return ch_ == '+' || ch_ == '-'; } |
127 | 111 |
128 // Return 1 for '+' and -1 for '-'. | 112 // Return 1 for '+' and -1 for '-'. |
129 int GetAsciiSignValue() const { return 44 - static_cast<int>(ch_); } | 113 int GetAsciiSignValue() const { return 44 - static_cast<int>(ch_); } |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 DateStringTokenizer<Char>* scanner, | 362 DateStringTokenizer<Char>* scanner, |
379 DayComposer* day, | 363 DayComposer* day, |
380 TimeComposer* time, | 364 TimeComposer* time, |
381 TimeZoneComposer* tz); | 365 TimeZoneComposer* tz); |
382 }; | 366 }; |
383 | 367 |
384 | 368 |
385 } } // namespace v8::internal | 369 } } // namespace v8::internal |
386 | 370 |
387 #endif // V8_DATEPARSER_H_ | 371 #endif // V8_DATEPARSER_H_ |
OLD | NEW |