| 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 #include "src/regexp/regexp-parser.h" | 5 #include "src/regexp/regexp-parser.h" |
| 6 | 6 |
| 7 #include "src/char-predicates-inl.h" | 7 #include "src/char-predicates-inl.h" |
| 8 #include "src/factory.h" | 8 #include "src/factory.h" |
| 9 #include "src/isolate.h" | 9 #include "src/isolate.h" |
| 10 #include "src/objects-inl.h" | 10 #include "src/objects-inl.h" |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 case '1': | 373 case '1': |
| 374 case '2': | 374 case '2': |
| 375 case '3': | 375 case '3': |
| 376 case '4': | 376 case '4': |
| 377 case '5': | 377 case '5': |
| 378 case '6': | 378 case '6': |
| 379 case '7': | 379 case '7': |
| 380 case '8': | 380 case '8': |
| 381 case '9': { | 381 case '9': { |
| 382 int index = 0; | 382 int index = 0; |
| 383 if (ParseBackReferenceIndex(&index)) { | 383 bool is_backref = ParseBackReferenceIndex(&index CHECK_FAILED); |
| 384 if (is_backref) { |
| 384 if (state->IsInsideCaptureGroup(index)) { | 385 if (state->IsInsideCaptureGroup(index)) { |
| 385 // The back reference is inside the capture group it refers to. | 386 // The back reference is inside the capture group it refers to. |
| 386 // Nothing can possibly have been captured yet, so we use empty | 387 // Nothing can possibly have been captured yet, so we use empty |
| 387 // instead. This ensures that, when checking a back reference, | 388 // instead. This ensures that, when checking a back reference, |
| 388 // the capture registers of the referenced capture are either | 389 // the capture registers of the referenced capture are either |
| 389 // both set or both cleared. | 390 // both set or both cleared. |
| 390 builder->AddEmpty(); | 391 builder->AddEmpty(); |
| 391 } else { | 392 } else { |
| 392 RegExpCapture* capture = GetCapture(index); | 393 RegExpCapture* capture = GetCapture(index); |
| 393 RegExpTree* atom = new (zone()) RegExpBackReference(capture); | 394 RegExpTree* atom = new (zone()) RegExpBackReference(capture); |
| (...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1443 return false; | 1444 return false; |
| 1444 } | 1445 } |
| 1445 terms_.Add(new (zone()) RegExpQuantifier(min, max, quantifier_type, atom), | 1446 terms_.Add(new (zone()) RegExpQuantifier(min, max, quantifier_type, atom), |
| 1446 zone()); | 1447 zone()); |
| 1447 LAST(ADD_TERM); | 1448 LAST(ADD_TERM); |
| 1448 return true; | 1449 return true; |
| 1449 } | 1450 } |
| 1450 | 1451 |
| 1451 } // namespace internal | 1452 } // namespace internal |
| 1452 } // namespace v8 | 1453 } // namespace v8 |
| OLD | NEW |