OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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_REGEXP_REGEXP_AST_H_ | 5 #ifndef V8_REGEXP_REGEXP_AST_H_ |
6 #define V8_REGEXP_REGEXP_AST_H_ | 6 #define V8_REGEXP_REGEXP_AST_H_ |
7 | 7 |
8 #include "src/objects.h" | 8 #include "src/objects.h" |
9 #include "src/utils.h" | 9 #include "src/utils.h" |
10 #include "src/zone.h" | 10 #include "src/zone.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 }; | 71 }; |
72 | 72 |
73 | 73 |
74 // Represents code units in the range from from_ to to_, both ends are | 74 // Represents code units in the range from from_ to to_, both ends are |
75 // inclusive. | 75 // inclusive. |
76 class CharacterRange { | 76 class CharacterRange { |
77 public: | 77 public: |
78 CharacterRange() : from_(0), to_(0) {} | 78 CharacterRange() : from_(0), to_(0) {} |
79 // For compatibility with the CHECK_OK macro | 79 // For compatibility with the CHECK_OK macro |
80 CharacterRange(void* null) { DCHECK_NULL(null); } // NOLINT | 80 CharacterRange(void* null) { DCHECK_NULL(null); } // NOLINT |
81 CharacterRange(uc32 from, uc32 to) : from_(from), to_(to) {} | 81 CharacterRange(uc32 from, uc32 to) : from_(from), to_(to) { |
| 82 DCHECK(from <= to); |
| 83 } |
82 static void AddClassEscape(uc16 type, ZoneList<CharacterRange>* ranges, | 84 static void AddClassEscape(uc16 type, ZoneList<CharacterRange>* ranges, |
83 Zone* zone); | 85 Zone* zone); |
84 static Vector<const int> GetWordBounds(); | 86 static Vector<const int> GetWordBounds(); |
85 static inline CharacterRange Singleton(uc32 value) { | 87 static inline CharacterRange Singleton(uc32 value) { |
86 return CharacterRange(value, value); | 88 return CharacterRange(value, value); |
87 } | 89 } |
88 static inline CharacterRange Range(uc32 from, uc32 to) { | 90 static inline CharacterRange Range(uc32 from, uc32 to) { |
89 DCHECK(0 <= from && to <= String::kMaxCodePoint); | 91 DCHECK(0 <= from && to <= String::kMaxCodePoint); |
90 DCHECK(static_cast<uint32_t>(from) <= static_cast<uint32_t>(to)); | 92 DCHECK(static_cast<uint32_t>(from) <= static_cast<uint32_t>(to)); |
91 return CharacterRange(from, to); | 93 return CharacterRange(from, to); |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 RegExpEmpty* AsEmpty() override; | 512 RegExpEmpty* AsEmpty() override; |
511 bool IsEmpty() override; | 513 bool IsEmpty() override; |
512 int min_match() override { return 0; } | 514 int min_match() override { return 0; } |
513 int max_match() override { return 0; } | 515 int max_match() override { return 0; } |
514 }; | 516 }; |
515 | 517 |
516 } // namespace internal | 518 } // namespace internal |
517 } // namespace v8 | 519 } // namespace v8 |
518 | 520 |
519 #endif // V8_REGEXP_REGEXP_AST_H_ | 521 #endif // V8_REGEXP_REGEXP_AST_H_ |
OLD | NEW |