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

Side by Side Diff: src/dateparser.h

Issue 6685088: Merge isolates to bleeding_edge. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 9 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/date.js ('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 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // Indicates a missing value. 63 // Indicates a missing value.
64 static const int kNone = kMaxInt; 64 static const int kNone = kMaxInt;
65 65
66 // InputReader provides basic string parsing and character classification. 66 // InputReader provides basic string parsing and character classification.
67 template <typename Char> 67 template <typename Char>
68 class InputReader BASE_EMBEDDED { 68 class InputReader BASE_EMBEDDED {
69 public: 69 public:
70 explicit InputReader(Vector<Char> s) 70 explicit InputReader(Vector<Char> s)
71 : index_(0), 71 : index_(0),
72 buffer_(s), 72 buffer_(s),
73 has_read_number_(false) { 73 has_read_number_(false),
74 scanner_constants_(Isolate::Current()->scanner_constants()) {
74 Next(); 75 Next();
75 } 76 }
76 77
77 // Advance to the next character of the string. 78 // Advance to the next character of the string.
78 void Next() { ch_ = (index_ < buffer_.length()) ? buffer_[index_++] : 0; } 79 void Next() { ch_ = (index_ < buffer_.length()) ? buffer_[index_++] : 0; }
79 80
80 // Read a string of digits as an unsigned number (cap just below kMaxInt). 81 // Read a string of digits as an unsigned number (cap just below kMaxInt).
81 int ReadUnsignedNumber() { 82 int ReadUnsignedNumber() {
82 has_read_number_ = true; 83 has_read_number_ = true;
83 int n; 84 int n;
(...skipping 30 matching lines...) Expand all
114 // The skip methods return whether they actually skipped something. 115 // The skip methods return whether they actually skipped something.
115 bool Skip(uint32_t c) { 116 bool Skip(uint32_t c) {
116 if (ch_ == c) { 117 if (ch_ == c) {
117 Next(); 118 Next();
118 return true; 119 return true;
119 } 120 }
120 return false; 121 return false;
121 } 122 }
122 123
123 bool SkipWhiteSpace() { 124 bool SkipWhiteSpace() {
124 if (ScannerConstants::kIsWhiteSpace.get(ch_)) { 125 if (scanner_constants_->IsWhiteSpace(ch_)) {
125 Next(); 126 Next();
126 return true; 127 return true;
127 } 128 }
128 return false; 129 return false;
129 } 130 }
130 131
131 bool SkipParentheses() { 132 bool SkipParentheses() {
132 if (ch_ != '(') return false; 133 if (ch_ != '(') return false;
133 int balance = 0; 134 int balance = 0;
134 do { 135 do {
(...skipping 15 matching lines...) Expand all
150 int GetAsciiSignValue() const { return 44 - static_cast<int>(ch_); } 151 int GetAsciiSignValue() const { return 44 - static_cast<int>(ch_); }
151 152
152 // Indicates whether any (possibly empty!) numbers have been read. 153 // Indicates whether any (possibly empty!) numbers have been read.
153 bool HasReadNumber() const { return has_read_number_; } 154 bool HasReadNumber() const { return has_read_number_; }
154 155
155 private: 156 private:
156 int index_; 157 int index_;
157 Vector<Char> buffer_; 158 Vector<Char> buffer_;
158 bool has_read_number_; 159 bool has_read_number_;
159 uint32_t ch_; 160 uint32_t ch_;
161 ScannerConstants* scanner_constants_;
160 }; 162 };
161 163
162 enum KeywordType { INVALID, MONTH_NAME, TIME_ZONE_NAME, AM_PM }; 164 enum KeywordType { INVALID, MONTH_NAME, TIME_ZONE_NAME, AM_PM };
163 165
164 // KeywordTable maps names of months, time zones, am/pm to numbers. 166 // KeywordTable maps names of months, time zones, am/pm to numbers.
165 class KeywordTable : public AllStatic { 167 class KeywordTable : public AllStatic {
166 public: 168 public:
167 // Look up a word in the keyword table and return an index. 169 // Look up a word in the keyword table and return an index.
168 // 'pre' contains a prefix of the word, zero-padded to size kPrefixLength 170 // 'pre' contains a prefix of the word, zero-padded to size kPrefixLength
169 // and 'len' is the word length. 171 // and 'len' is the word length.
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 int comp_[kSize]; 256 int comp_[kSize];
255 int index_; 257 int index_;
256 int named_month_; 258 int named_month_;
257 }; 259 };
258 }; 260 };
259 261
260 262
261 } } // namespace v8::internal 263 } } // namespace v8::internal
262 264
263 #endif // V8_DATEPARSER_H_ 265 #endif // V8_DATEPARSER_H_
OLDNEW
« no previous file with comments | « src/date.js ('k') | src/debug.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698