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

Side by Side Diff: src/jsregexp.cc

Issue 553067: Fix bug in character-set merging. Add test case. (Closed)
Patch Set: Created 10 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 | « no previous file | 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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 4444 matching lines...) Expand 10 before | Expand all | Expand 10 after
4455 int n2 = second_set->length(); 4455 int n2 = second_set->length();
4456 // Current range. May be invalid if state is kInsideNone. 4456 // Current range. May be invalid if state is kInsideNone.
4457 int from = 0; 4457 int from = 0;
4458 int to = -1; 4458 int to = -1;
4459 // Where current range comes from. 4459 // Where current range comes from.
4460 int state = kInsideNone; 4460 int state = kInsideNone;
4461 4461
4462 while (i1 < n1 || i2 < n2) { 4462 while (i1 < n1 || i2 < n2) {
4463 CharacterRange next_range; 4463 CharacterRange next_range;
4464 int range_source; 4464 int range_source;
4465 if (i2 == n2 || first_set->at(i1).from() < second_set->at(i2).from()) { 4465 if (i2 == n2 ||
4466 (i1 < n1 && first_set->at(i1).from() < second_set->at(i2).from())) {
4467 // Next smallest element is in first set.
4466 next_range = first_set->at(i1++); 4468 next_range = first_set->at(i1++);
4467 range_source = kInsideFirst; 4469 range_source = kInsideFirst;
4468 } else { 4470 } else {
4471 // Next smallest element is in second set.
4469 next_range = second_set->at(i2++); 4472 next_range = second_set->at(i2++);
4470 range_source = kInsideSecond; 4473 range_source = kInsideSecond;
4471 } 4474 }
4472 if (to < next_range.from()) { 4475 if (to < next_range.from()) {
4473 // Ranges disjoint: |current| |next| 4476 // Ranges disjoint: |current| |next|
4474 AddRangeToSelectedSet(state, 4477 AddRangeToSelectedSet(state,
4475 first_set_only_out, 4478 first_set_only_out,
4476 second_set_only_out, 4479 second_set_only_out,
4477 both_sets_out, 4480 both_sets_out,
4478 CharacterRange(from, to)); 4481 CharacterRange(from, to));
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
5222 node, 5225 node,
5223 data->capture_count, 5226 data->capture_count,
5224 pattern); 5227 pattern);
5225 } 5228 }
5226 5229
5227 5230
5228 int OffsetsVector::static_offsets_vector_[ 5231 int OffsetsVector::static_offsets_vector_[
5229 OffsetsVector::kStaticOffsetsVectorSize]; 5232 OffsetsVector::kStaticOffsetsVectorSize];
5230 5233
5231 }} // namespace v8::internal 5234 }} // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-regexp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698