| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 // translation between position and utf8 position. | 173 // translation between position and utf8 position. |
| 174 static char* utf8_subject_cache_; | 174 static char* utf8_subject_cache_; |
| 175 static int utf8_length_cache_; | 175 static int utf8_length_cache_; |
| 176 static int utf8_position_; | 176 static int utf8_position_; |
| 177 static int character_position_; | 177 static int character_position_; |
| 178 }; | 178 }; |
| 179 | 179 |
| 180 | 180 |
| 181 class CharacterRange { | 181 class CharacterRange { |
| 182 public: | 182 public: |
| 183 CharacterRange() : from_(0), to_(0) { } |
| 183 // For compatibility with the CHECK_OK macro | 184 // For compatibility with the CHECK_OK macro |
| 184 CharacterRange(void* null) { ASSERT_EQ(NULL, null); } //NOLINT | 185 CharacterRange(void* null) { ASSERT_EQ(NULL, null); } //NOLINT |
| 185 CharacterRange(uc16 from, uc16 to) | 186 CharacterRange(uc16 from, uc16 to) |
| 186 : from_(from), | 187 : from_(from), |
| 187 to_(to) { | 188 to_(to) { |
| 188 } | 189 } |
| 189 static void AddClassEscape(uc16 type, ZoneList<CharacterRange>* ranges); | 190 static void AddClassEscape(uc16 type, ZoneList<CharacterRange>* ranges); |
| 190 static inline CharacterRange Singleton(uc16 value) { | 191 static inline CharacterRange Singleton(uc16 value) { |
| 191 return CharacterRange(value, value); | 192 return CharacterRange(value, value); |
| 192 } | 193 } |
| 193 static inline CharacterRange Range(uc16 from, uc16 to) { | 194 static inline CharacterRange Range(uc16 from, uc16 to) { |
| 194 ASSERT(from <= to); | 195 ASSERT(from <= to); |
| 195 return CharacterRange(from, to); | 196 return CharacterRange(from, to); |
| 196 } | 197 } |
| 197 static inline CharacterRange Everything() { | 198 static inline CharacterRange Everything() { |
| 198 return CharacterRange(0, 0xFFFF); | 199 return CharacterRange(0, 0xFFFF); |
| 199 } | 200 } |
| 200 bool Contains(uc16 i) { return from_ <= i && i <= to_; } | 201 bool Contains(uc16 i) { return from_ <= i && i <= to_; } |
| 201 uc16 from() const { return from_; } | 202 uc16 from() const { return from_; } |
| 202 void set_from(uc16 value) { from_ = value; } | 203 void set_from(uc16 value) { from_ = value; } |
| 203 uc16 to() const { return to_; } | 204 uc16 to() const { return to_; } |
| 204 void set_to(uc16 value) { to_ = value; } | 205 void set_to(uc16 value) { to_ = value; } |
| 205 bool is_valid() { return from_ <= to_; } | 206 bool is_valid() { return from_ <= to_; } |
| 206 bool IsSingleton() { return (from_ == to_); } | 207 bool IsSingleton() { return (from_ == to_); } |
| 208 void AddCaseEquivalents(ZoneList<CharacterRange>* ranges); |
| 209 static const int kRangeCanonicalizeMax = 0x200; |
| 210 static const int kStartMarker = (1 << 10); |
| 211 static const int kPayloadMask = (1 << 10) - 1; |
| 207 private: | 212 private: |
| 208 uc16 from_; | 213 uc16 from_; |
| 209 uc16 to_; | 214 uc16 to_; |
| 210 }; | 215 }; |
| 211 | 216 |
| 212 | 217 |
| 213 template <typename Node, class Callback> | 218 template <typename Node, class Callback> |
| 214 static void DoForEach(Node* node, Callback* callback); | 219 static void DoForEach(Node* node, Callback* callback); |
| 215 | 220 |
| 216 | 221 |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 static Handle<FixedArray> Compile(RegExpParseResult* input, | 767 static Handle<FixedArray> Compile(RegExpParseResult* input, |
| 763 RegExpNode** node_return, | 768 RegExpNode** node_return, |
| 764 bool ignore_case); | 769 bool ignore_case); |
| 765 static void DotPrint(const char* label, RegExpNode* node); | 770 static void DotPrint(const char* label, RegExpNode* node); |
| 766 }; | 771 }; |
| 767 | 772 |
| 768 | 773 |
| 769 } } // namespace v8::internal | 774 } } // namespace v8::internal |
| 770 | 775 |
| 771 #endif // V8_JSREGEXP_H_ | 776 #endif // V8_JSREGEXP_H_ |
| OLD | NEW |