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

Side by Side Diff: src/jsregexp.cc

Issue 1712013: Fix bug in word-boundary-lookahead followed by end-of-input assertion. (Closed)
Patch Set: Added more tests Created 10 years, 8 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 | src/regexp-macro-assembler-tracer.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 4854 matching lines...) Expand 10 before | Expand all | Expand 10 after
4865 if (type == AssertionNode::AT_BOUNDARY || 4865 if (type == AssertionNode::AT_BOUNDARY ||
4866 type == AssertionNode::AT_NON_BOUNDARY) { 4866 type == AssertionNode::AT_NON_BOUNDARY) {
4867 // Check if the following character is known to be a word character 4867 // Check if the following character is known to be a word character
4868 // or known to not be a word character. 4868 // or known to not be a word character.
4869 ZoneList<CharacterRange>* following_chars = that->FirstCharacterSet(); 4869 ZoneList<CharacterRange>* following_chars = that->FirstCharacterSet();
4870 4870
4871 CharacterRange::Canonicalize(following_chars); 4871 CharacterRange::Canonicalize(following_chars);
4872 4872
4873 SetRelation word_relation = 4873 SetRelation word_relation =
4874 CharacterRange::WordCharacterRelation(following_chars); 4874 CharacterRange::WordCharacterRelation(following_chars);
4875 if (word_relation.ContainedIn()) { 4875 if (word_relation.Disjoint()) {
4876 // Includes the case where following_chars is empty (e.g., end-of-input).
4877 // Following character is definitely *not* a word character.
4878 type = (type == AssertionNode::AT_BOUNDARY) ?
4879 AssertionNode::AFTER_WORD_CHARACTER :
4880 AssertionNode::AFTER_NONWORD_CHARACTER;
4881 that->set_type(type);
4882 } else if (word_relation.ContainedIn()) {
4876 // Following character is definitely a word character. 4883 // Following character is definitely a word character.
4877 type = (type == AssertionNode::AT_BOUNDARY) ? 4884 type = (type == AssertionNode::AT_BOUNDARY) ?
4878 AssertionNode::AFTER_NONWORD_CHARACTER : 4885 AssertionNode::AFTER_NONWORD_CHARACTER :
4879 AssertionNode::AFTER_WORD_CHARACTER; 4886 AssertionNode::AFTER_WORD_CHARACTER;
4880 that->set_type(type);
4881 } else if (word_relation.Disjoint()) {
4882 // Following character is definitely *not* a word character.
4883 type = (type == AssertionNode::AT_BOUNDARY) ?
4884 AssertionNode::AFTER_WORD_CHARACTER :
4885 AssertionNode::AFTER_NONWORD_CHARACTER;
4886 that->set_type(type); 4887 that->set_type(type);
4887 } 4888 }
4888 } 4889 }
4889 } 4890 }
4890 4891
4891 4892
4892 ZoneList<CharacterRange>* RegExpNode::FirstCharacterSet() { 4893 ZoneList<CharacterRange>* RegExpNode::FirstCharacterSet() {
4893 if (first_character_set_ == NULL) { 4894 if (first_character_set_ == NULL) {
4894 if (ComputeFirstCharacterSet(kFirstCharBudget) < 0) { 4895 if (ComputeFirstCharacterSet(kFirstCharBudget) < 0) {
4895 // If we can't find an exact solution within the budget, we 4896 // If we can't find an exact solution within the budget, we
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
5257 node, 5258 node,
5258 data->capture_count, 5259 data->capture_count,
5259 pattern); 5260 pattern);
5260 } 5261 }
5261 5262
5262 5263
5263 int OffsetsVector::static_offsets_vector_[ 5264 int OffsetsVector::static_offsets_vector_[
5264 OffsetsVector::kStaticOffsetsVectorSize]; 5265 OffsetsVector::kStaticOffsetsVectorSize];
5265 5266
5266 }} // namespace v8::internal 5267 }} // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/regexp-macro-assembler-tracer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698