OLD | NEW |
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 4852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4863 if (type == AssertionNode::AT_BOUNDARY || | 4863 if (type == AssertionNode::AT_BOUNDARY || |
4864 type == AssertionNode::AT_NON_BOUNDARY) { | 4864 type == AssertionNode::AT_NON_BOUNDARY) { |
4865 // Check if the following character is known to be a word character | 4865 // Check if the following character is known to be a word character |
4866 // or known to not be a word character. | 4866 // or known to not be a word character. |
4867 ZoneList<CharacterRange>* following_chars = that->FirstCharacterSet(); | 4867 ZoneList<CharacterRange>* following_chars = that->FirstCharacterSet(); |
4868 | 4868 |
4869 CharacterRange::Canonicalize(following_chars); | 4869 CharacterRange::Canonicalize(following_chars); |
4870 | 4870 |
4871 SetRelation word_relation = | 4871 SetRelation word_relation = |
4872 CharacterRange::WordCharacterRelation(following_chars); | 4872 CharacterRange::WordCharacterRelation(following_chars); |
4873 if (word_relation.ContainedIn()) { | 4873 if (word_relation.Disjoint()) { |
| 4874 // Includes the case where following_chars is empty (e.g., end-of-input). |
| 4875 // Following character is definitely *not* a word character. |
| 4876 type = (type == AssertionNode::AT_BOUNDARY) ? |
| 4877 AssertionNode::AFTER_WORD_CHARACTER : |
| 4878 AssertionNode::AFTER_NONWORD_CHARACTER; |
| 4879 that->set_type(type); |
| 4880 } else if (word_relation.ContainedIn()) { |
4874 // Following character is definitely a word character. | 4881 // Following character is definitely a word character. |
4875 type = (type == AssertionNode::AT_BOUNDARY) ? | 4882 type = (type == AssertionNode::AT_BOUNDARY) ? |
4876 AssertionNode::AFTER_NONWORD_CHARACTER : | 4883 AssertionNode::AFTER_NONWORD_CHARACTER : |
4877 AssertionNode::AFTER_WORD_CHARACTER; | 4884 AssertionNode::AFTER_WORD_CHARACTER; |
4878 that->set_type(type); | |
4879 } else if (word_relation.Disjoint()) { | |
4880 // Following character is definitely *not* a word character. | |
4881 type = (type == AssertionNode::AT_BOUNDARY) ? | |
4882 AssertionNode::AFTER_WORD_CHARACTER : | |
4883 AssertionNode::AFTER_NONWORD_CHARACTER; | |
4884 that->set_type(type); | 4885 that->set_type(type); |
4885 } | 4886 } |
4886 } | 4887 } |
4887 } | 4888 } |
4888 | 4889 |
4889 | 4890 |
4890 ZoneList<CharacterRange>* RegExpNode::FirstCharacterSet() { | 4891 ZoneList<CharacterRange>* RegExpNode::FirstCharacterSet() { |
4891 if (first_character_set_ == NULL) { | 4892 if (first_character_set_ == NULL) { |
4892 if (ComputeFirstCharacterSet(kFirstCharBudget) < 0) { | 4893 if (ComputeFirstCharacterSet(kFirstCharBudget) < 0) { |
4893 // If we can't find an exact solution within the budget, we | 4894 // If we can't find an exact solution within the budget, we |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5246 node, | 5247 node, |
5247 data->capture_count, | 5248 data->capture_count, |
5248 pattern); | 5249 pattern); |
5249 } | 5250 } |
5250 | 5251 |
5251 | 5252 |
5252 int OffsetsVector::static_offsets_vector_[ | 5253 int OffsetsVector::static_offsets_vector_[ |
5253 OffsetsVector::kStaticOffsetsVectorSize]; | 5254 OffsetsVector::kStaticOffsetsVectorSize]; |
5254 | 5255 |
5255 }} // namespace v8::internal | 5256 }} // namespace v8::internal |
OLD | NEW |