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

Side by Side Diff: src/regexp/regexp-parser.cc

Issue 2636883002: [regexp] Implement regexp groups as wrapper. (Closed)
Patch Set: fix Created 3 years, 11 months 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
« no previous file with comments | « src/regexp/regexp-ast.cc ('k') | test/cctest/test-regexp.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 209
210 // Build result of subexpression. 210 // Build result of subexpression.
211 if (group_type == CAPTURE) { 211 if (group_type == CAPTURE) {
212 if (state->IsNamedCapture()) { 212 if (state->IsNamedCapture()) {
213 CreateNamedCaptureAtIndex(state->capture_name(), 213 CreateNamedCaptureAtIndex(state->capture_name(),
214 capture_index CHECK_FAILED); 214 capture_index CHECK_FAILED);
215 } 215 }
216 RegExpCapture* capture = GetCapture(capture_index); 216 RegExpCapture* capture = GetCapture(capture_index);
217 capture->set_body(body); 217 capture->set_body(body);
218 body = capture; 218 body = capture;
219 } else if (group_type != GROUPING) { 219 } else if (group_type == GROUPING) {
220 body = new (zone()) RegExpGroup(body);
221 } else {
220 DCHECK(group_type == POSITIVE_LOOKAROUND || 222 DCHECK(group_type == POSITIVE_LOOKAROUND ||
221 group_type == NEGATIVE_LOOKAROUND); 223 group_type == NEGATIVE_LOOKAROUND);
222 bool is_positive = (group_type == POSITIVE_LOOKAROUND); 224 bool is_positive = (group_type == POSITIVE_LOOKAROUND);
223 body = new (zone()) RegExpLookaround( 225 body = new (zone()) RegExpLookaround(
224 body, is_positive, end_capture_index - capture_index, 226 body, is_positive, end_capture_index - capture_index,
225 capture_index, state->lookaround_type()); 227 capture_index, state->lookaround_type());
226 } 228 }
227 229
228 // Restore previous state. 230 // Restore previous state.
229 state = state->previous_state(); 231 state = state->previous_state();
(...skipping 1561 matching lines...) Expand 10 before | Expand all | Expand 10 after
1791 return false; 1793 return false;
1792 } 1794 }
1793 terms_.Add(new (zone()) RegExpQuantifier(min, max, quantifier_type, atom), 1795 terms_.Add(new (zone()) RegExpQuantifier(min, max, quantifier_type, atom),
1794 zone()); 1796 zone());
1795 LAST(ADD_TERM); 1797 LAST(ADD_TERM);
1796 return true; 1798 return true;
1797 } 1799 }
1798 1800
1799 } // namespace internal 1801 } // namespace internal
1800 } // namespace v8 1802 } // namespace v8
OLDNEW
« no previous file with comments | « src/regexp/regexp-ast.cc ('k') | test/cctest/test-regexp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698