| 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_PARSER_H_ | 5 #ifndef V8_REGEXP_REGEXP_PARSER_H_ |
| 6 #define V8_REGEXP_REGEXP_PARSER_H_ | 6 #define V8_REGEXP_REGEXP_PARSER_H_ |
| 7 | 7 |
| 8 #include "src/objects.h" | 8 #include "src/objects.h" |
| 9 #include "src/regexp/regexp-ast.h" | 9 #include "src/regexp/regexp-ast.h" |
| 10 #include "src/zone/zone.h" | 10 #include "src/zone/zone.h" |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 bool ParseNamedBackReference(RegExpBuilder* builder, | 286 bool ParseNamedBackReference(RegExpBuilder* builder, |
| 287 RegExpParserState* state); | 287 RegExpParserState* state); |
| 288 | 288 |
| 289 // After the initial parsing pass, patch corresponding RegExpCapture objects | 289 // After the initial parsing pass, patch corresponding RegExpCapture objects |
| 290 // into all RegExpBackReferences. This is done after initial parsing in order | 290 // into all RegExpBackReferences. This is done after initial parsing in order |
| 291 // to avoid complicating cases in which references comes before the capture. | 291 // to avoid complicating cases in which references comes before the capture. |
| 292 void PatchNamedBackReferences(); | 292 void PatchNamedBackReferences(); |
| 293 | 293 |
| 294 Handle<FixedArray> CreateCaptureNameMap(); | 294 Handle<FixedArray> CreateCaptureNameMap(); |
| 295 | 295 |
| 296 // Returns true iff the pattern contains named captures. May call |
| 297 // ScanForCaptures to look ahead at the remaining pattern. |
| 298 bool HasNamedCaptures(); |
| 299 |
| 296 Isolate* isolate() { return isolate_; } | 300 Isolate* isolate() { return isolate_; } |
| 297 Zone* zone() const { return zone_; } | 301 Zone* zone() const { return zone_; } |
| 298 | 302 |
| 299 uc32 current() { return current_; } | 303 uc32 current() { return current_; } |
| 300 bool has_more() { return has_more_; } | 304 bool has_more() { return has_more_; } |
| 301 bool has_next() { return next_pos_ < in()->length(); } | 305 bool has_next() { return next_pos_ < in()->length(); } |
| 302 uc32 Next(); | 306 uc32 Next(); |
| 303 template <bool update_position> | 307 template <bool update_position> |
| 304 uc32 ReadNext(); | 308 uc32 ReadNext(); |
| 305 FlatStringReader* in() { return in_; } | 309 FlatStringReader* in() { return in_; } |
| 306 void ScanForCaptures(); | 310 void ScanForCaptures(); |
| 307 | 311 |
| 308 Isolate* isolate_; | 312 Isolate* isolate_; |
| 309 Zone* zone_; | 313 Zone* zone_; |
| 310 Handle<String>* error_; | 314 Handle<String>* error_; |
| 311 ZoneList<RegExpCapture*>* captures_; | 315 ZoneList<RegExpCapture*>* captures_; |
| 312 ZoneList<RegExpCapture*>* named_captures_; | 316 ZoneList<RegExpCapture*>* named_captures_; |
| 313 ZoneList<RegExpBackReference*>* named_back_references_; | 317 ZoneList<RegExpBackReference*>* named_back_references_; |
| 314 FlatStringReader* in_; | 318 FlatStringReader* in_; |
| 315 uc32 current_; | 319 uc32 current_; |
| 316 bool dotall_; | 320 bool dotall_; |
| 317 bool ignore_case_; | 321 bool ignore_case_; |
| 318 bool multiline_; | 322 bool multiline_; |
| 319 bool unicode_; | 323 bool unicode_; |
| 320 int next_pos_; | 324 int next_pos_; |
| 321 int captures_started_; | 325 int captures_started_; |
| 322 // The capture count is only valid after we have scanned for captures. | 326 int capture_count_; // Only valid after we have scanned for captures. |
| 323 int capture_count_; | |
| 324 bool has_more_; | 327 bool has_more_; |
| 325 bool simple_; | 328 bool simple_; |
| 326 bool contains_anchor_; | 329 bool contains_anchor_; |
| 327 bool is_scanned_for_captures_; | 330 bool is_scanned_for_captures_; |
| 331 bool has_named_captures_; // Only valid after we have scanned for captures. |
| 328 bool failed_; | 332 bool failed_; |
| 329 }; | 333 }; |
| 330 | 334 |
| 331 } // namespace internal | 335 } // namespace internal |
| 332 } // namespace v8 | 336 } // namespace v8 |
| 333 | 337 |
| 334 #endif // V8_REGEXP_REGEXP_PARSER_H_ | 338 #endif // V8_REGEXP_REGEXP_PARSER_H_ |
| OLD | NEW |