Index: src/jsregexp.cc |
=================================================================== |
--- src/jsregexp.cc (revision 847) |
+++ src/jsregexp.cc (working copy) |
@@ -473,7 +473,7 @@ |
if (FLAG_trace_regexp_bytecodes) { |
String* pattern = regexp->Pattern(); |
PrintF("\n\nRegexp match: /%s/\n\n", *(pattern->ToCString())); |
- PrintF("\n\nSubject string: '%s'\n\n", *(two_byte_subject->ToCString())); |
+ //PrintF("\n\nSubject string: '%s'\n\n", *(two_byte_subject->ToCString())); |
Christian Plesner Hansen
2008/11/27 06:49:39
Either comment it back in or remove it.
|
} |
#endif |
ASSERT(StringShape(*two_byte_subject).IsTwoByteRepresentation()); |
@@ -931,9 +931,6 @@ |
RegExpMacroAssembler* macro_assembler, |
RegExpNode* start, |
int capture_count) { |
- if (!FLAG_attempt_case_independent && is_case_independent_) { |
- return Handle<FixedArray>::null(); |
- } |
macro_assembler_ = macro_assembler; |
List <RegExpNode*> work_list(0); |
work_list_ = &work_list; |
@@ -1356,6 +1353,22 @@ |
} |
+void TextNode::MakeCaseIndependent() { |
+ int element_count = elms_->length(); |
+ for (int i = 0; i < element_count; i++) { |
+ TextElement elm = elms_->at(i); |
+ if (elm.type == TextElement::CHAR_CLASS) { |
+ RegExpCharacterClass* cc = elm.data.u_char_class; |
+ ZoneList<CharacterRange>* ranges = cc->ranges(); |
+ int range_count = ranges->length(); |
+ for (int i = 0; i < range_count; i++) { |
+ ranges->at(i).AddCaseEquivalents(ranges); |
+ } |
+ } |
+ } |
+} |
+ |
+ |
bool ChoiceNode::Emit(RegExpCompiler* compiler) { |
int choice_count = alternatives_->length(); |
RegExpMacroAssembler* macro_assembler = compiler->macro_assembler(); |
@@ -2397,6 +2410,9 @@ |
void Analysis::VisitText(TextNode* that) { |
+ if (case_independent_) { |
+ that->MakeCaseIndependent(); |
+ } |
EnsureAnalyzed(that->on_success()); |
EnsureAnalyzed(that->on_failure()); |
} |
@@ -2572,7 +2588,7 @@ |
captured_body, |
compiler.backtrack()); |
if (node_return != NULL) *node_return = node; |
- Analysis analysis; |
+ Analysis analysis(ignore_case); |
analysis.EnsureAnalyzed(node); |
if (!FLAG_irregexp) { |