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

Side by Side Diff: src/jsregexp.h

Issue 9638: More automaton translation (Closed)
Patch Set: Created 12 years, 1 month 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
OLDNEW
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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 // A one element cache of the last utf8_subject string and its length. The 129 // A one element cache of the last utf8_subject string and its length. The
130 // subject JS String object is cached in the heap. We also cache a 130 // subject JS String object is cached in the heap. We also cache a
131 // translation between position and utf8 position. 131 // translation between position and utf8 position.
132 static char* utf8_subject_cache_; 132 static char* utf8_subject_cache_;
133 static int utf8_length_cache_; 133 static int utf8_length_cache_;
134 static int utf8_position_; 134 static int utf8_position_;
135 static int character_position_; 135 static int character_position_;
136 }; 136 };
137 137
138 138
139 template <typename Char> class RegExpNode;
140
141
142 class CharacterRange { 139 class CharacterRange {
143 public: 140 public:
144 // For compatibility with the CHECK_OK macro 141 // For compatibility with the CHECK_OK macro
145 CharacterRange(void* null) { ASSERT_EQ(NULL, null); } //NOLINT 142 CharacterRange(void* null) { ASSERT_EQ(NULL, null); } //NOLINT
146 CharacterRange(uc16 from, uc16 to) 143 CharacterRange(uc16 from, uc16 to)
147 : from_(from), 144 : from_(from),
148 to_(to) { 145 to_(to) {
149 } 146 }
150 static void AddClassEscape(uc16 type, ZoneList<CharacterRange>* ranges); 147 static void AddClassEscape(uc16 type, ZoneList<CharacterRange>* ranges);
151 static inline CharacterRange Singleton(uc16 value) { 148 static inline CharacterRange Singleton(uc16 value) {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 } 308 }
312 }; 309 };
313 void AddRange(CharacterRange range, int value); 310 void AddRange(CharacterRange range, int value);
314 OutSet Get(uc16 value); 311 OutSet Get(uc16 value);
315 private: 312 private:
316 ZoneSplayTree<Config>* tree() { return &tree_; } 313 ZoneSplayTree<Config>* tree() { return &tree_; }
317 ZoneSplayTree<Config> tree_; 314 ZoneSplayTree<Config> tree_;
318 }; 315 };
319 316
320 317
318 struct RegExpParseResult {
319 RegExpTree* tree;
320 bool has_character_escapes;
321 Handle<String> error;
322 int capture_count;
323 };
Lasse Reichstein 2008/11/06 16:46:44 What!?! No third out-parameter? ;) Good call.
324
325
321 class RegExpEngine: public AllStatic { 326 class RegExpEngine: public AllStatic {
322 public: 327 public:
323 template <typename Char> 328 static RegExpNode* Compile(RegExpParseResult* input);
324 static RegExpNode<Char>* Compile(RegExpTree* regexp); 329 static void DotPrint(const char* label, RegExpNode* node);
325
326 template <typename Char>
327 static bool Execute(RegExpNode<Char>* start, Vector<Char> input);
328 }; 330 };
329 331
330 332
331 } } // namespace v8::internal 333 } } // namespace v8::internal
332 334
333 #endif // V8_JSREGEXP_H_ 335 #endif // V8_JSREGEXP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698