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

Side by Side Diff: src/dateparser.h

Issue 435003: Patch for allowing several V8 instances in process:... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years 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/counters.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 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 // Indicates a missing value. 61 // Indicates a missing value.
62 static const int kNone = kMaxInt; 62 static const int kNone = kMaxInt;
63 63
64 // InputReader provides basic string parsing and character classification. 64 // InputReader provides basic string parsing and character classification.
65 template <typename Char> 65 template <typename Char>
66 class InputReader BASE_EMBEDDED { 66 class InputReader BASE_EMBEDDED {
67 public: 67 public:
68 explicit InputReader(Vector<Char> s) 68 explicit InputReader(Vector<Char> s)
69 : index_(0), 69 : index_(0),
70 buffer_(s), 70 buffer_(s),
71 v8context_(v8_context()),
71 has_read_number_(false) { 72 has_read_number_(false) {
72 Next(); 73 Next();
73 } 74 }
74 75
75 // Advance to the next character of the string. 76 // Advance to the next character of the string.
76 void Next() { ch_ = (index_ < buffer_.length()) ? buffer_[index_++] : 0; } 77 void Next() { ch_ = (index_ < buffer_.length()) ? buffer_[index_++] : 0; }
77 78
78 // Read a string of digits as an unsigned number (cap just below kMaxInt). 79 // Read a string of digits as an unsigned number (cap just below kMaxInt).
79 int ReadUnsignedNumber() { 80 int ReadUnsignedNumber() {
80 has_read_number_ = true; 81 has_read_number_ = true;
(...skipping 13 matching lines...) Expand all
94 if (len < prefix_size) prefix[len] = GetAsciiAlphaLower(); 95 if (len < prefix_size) prefix[len] = GetAsciiAlphaLower();
95 } 96 }
96 for (int i = len; i < prefix_size; i++) prefix[i] = 0; 97 for (int i = len; i < prefix_size; i++) prefix[i] = 0;
97 return len; 98 return len;
98 } 99 }
99 100
100 // The skip methods return whether they actually skipped something. 101 // The skip methods return whether they actually skipped something.
101 bool Skip(uint32_t c) { return ch_ == c ? (Next(), true) : false; } 102 bool Skip(uint32_t c) { return ch_ == c ? (Next(), true) : false; }
102 103
103 bool SkipWhiteSpace() { 104 bool SkipWhiteSpace() {
104 return Scanner::kIsWhiteSpace.get(ch_) ? (Next(), true) : false; 105 return v8context_->scanner_data_.
106 kIsWhiteSpace_.get(ch_) ? (Next(), true) : false;
105 } 107 }
106 108
107 bool SkipParentheses() { 109 bool SkipParentheses() {
108 if (ch_ != '(') return false; 110 if (ch_ != '(') return false;
109 int balance = 0; 111 int balance = 0;
110 do { 112 do {
111 if (ch_ == ')') --balance; 113 if (ch_ == ')') --balance;
112 else if (ch_ == '(') ++balance; 114 else if (ch_ == '(') ++balance;
113 Next(); 115 Next();
114 } while (balance > 0 && ch_); 116 } while (balance > 0 && ch_);
(...skipping 12 matching lines...) Expand all
127 129
128 // Indicates whether any (possibly empty!) numbers have been read. 130 // Indicates whether any (possibly empty!) numbers have been read.
129 bool HasReadNumber() const { return has_read_number_; } 131 bool HasReadNumber() const { return has_read_number_; }
130 132
131 private: 133 private:
132 // If current character is in 'A'-'Z' or 'a'-'z', return its lower-case. 134 // If current character is in 'A'-'Z' or 'a'-'z', return its lower-case.
133 // Else, return something outside of 'A'-'Z' and 'a'-'z'. 135 // Else, return something outside of 'A'-'Z' and 'a'-'z'.
134 uint32_t GetAsciiAlphaLower() const { return ch_ | 32; } 136 uint32_t GetAsciiAlphaLower() const { return ch_ | 32; }
135 137
136 int index_; 138 int index_;
139 V8Context* const v8context_;
137 Vector<Char> buffer_; 140 Vector<Char> buffer_;
138 bool has_read_number_; 141 bool has_read_number_;
139 uint32_t ch_; 142 uint32_t ch_;
140 }; 143 };
141 144
142 enum KeywordType { INVALID, MONTH_NAME, TIME_ZONE_NAME, AM_PM }; 145 enum KeywordType { INVALID, MONTH_NAME, TIME_ZONE_NAME, AM_PM };
143 146
144 // KeywordTable maps names of months, time zones, am/pm to numbers. 147 // KeywordTable maps names of months, time zones, am/pm to numbers.
145 class KeywordTable : public AllStatic { 148 class KeywordTable : public AllStatic {
146 public: 149 public:
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 int comp_[kSize]; 234 int comp_[kSize];
232 int index_; 235 int index_;
233 int named_month_; 236 int named_month_;
234 }; 237 };
235 }; 238 };
236 239
237 240
238 } } // namespace v8::internal 241 } } // namespace v8::internal
239 242
240 #endif // V8_DATEPARSER_H_ 243 #endif // V8_DATEPARSER_H_
OLDNEW
« no previous file with comments | « src/counters.cc ('k') | src/debug.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698