OLD | NEW |
---|---|
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
589 RegExpNode* on_success, | 589 RegExpNode* on_success, |
590 RegExpNode* on_failure) | 590 RegExpNode* on_failure) |
591 : SeqRegExpNode(on_success), | 591 : SeqRegExpNode(on_success), |
592 on_failure_(on_failure), | 592 on_failure_(on_failure), |
593 elms_(elms) { } | 593 elms_(elms) { } |
594 virtual void Accept(NodeVisitor* visitor); | 594 virtual void Accept(NodeVisitor* visitor); |
595 virtual RegExpNode* PropagateInterest(NodeInfo* info); | 595 virtual RegExpNode* PropagateInterest(NodeInfo* info); |
596 RegExpNode* on_failure() { return on_failure_; } | 596 RegExpNode* on_failure() { return on_failure_; } |
597 virtual bool Emit(RegExpCompiler* compiler); | 597 virtual bool Emit(RegExpCompiler* compiler); |
598 ZoneList<TextElement>* elements() { return elms_; } | 598 ZoneList<TextElement>* elements() { return elms_; } |
599 void MakeCaseIndependent(); | |
599 private: | 600 private: |
600 RegExpNode* on_failure_; | 601 RegExpNode* on_failure_; |
601 ZoneList<TextElement>* elms_; | 602 ZoneList<TextElement>* elms_; |
602 }; | 603 }; |
603 | 604 |
604 | 605 |
605 class BackReferenceNode: public SeqRegExpNode { | 606 class BackReferenceNode: public SeqRegExpNode { |
606 public: | 607 public: |
607 BackReferenceNode(int start_reg, | 608 BackReferenceNode(int start_reg, |
608 int end_reg, | 609 int end_reg, |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
734 void set_choice_index(int value) { choice_index_ = value; } | 735 void set_choice_index(int value) { choice_index_ = value; } |
735 | 736 |
736 protected: | 737 protected: |
737 DispatchTable *table_; | 738 DispatchTable *table_; |
738 int choice_index_; | 739 int choice_index_; |
739 }; | 740 }; |
740 | 741 |
741 | 742 |
742 class Analysis: public NodeVisitor { | 743 class Analysis: public NodeVisitor { |
743 public: | 744 public: |
745 explicit Analysis(bool case_independent) | |
Christian Plesner Hansen
2008/11/27 06:49:39
We're somewhat inconsistent in what we call this:
| |
746 : case_independent_(case_independent) { } | |
744 void EnsureAnalyzed(RegExpNode* node); | 747 void EnsureAnalyzed(RegExpNode* node); |
745 | 748 |
746 #define DECLARE_VISIT(Type) \ | 749 #define DECLARE_VISIT(Type) \ |
747 virtual void Visit##Type(Type##Node* that); | 750 virtual void Visit##Type(Type##Node* that); |
748 FOR_EACH_NODE_TYPE(DECLARE_VISIT) | 751 FOR_EACH_NODE_TYPE(DECLARE_VISIT) |
749 #undef DECLARE_VISIT | 752 #undef DECLARE_VISIT |
753 | |
754 private: | |
755 bool case_independent_; | |
756 | |
757 DISALLOW_IMPLICIT_CONSTRUCTORS(Analysis); | |
750 }; | 758 }; |
751 | 759 |
752 | 760 |
753 struct RegExpParseResult { | 761 struct RegExpParseResult { |
754 RegExpTree* tree; | 762 RegExpTree* tree; |
755 bool has_character_escapes; | 763 bool has_character_escapes; |
756 Handle<String> error; | 764 Handle<String> error; |
757 int capture_count; | 765 int capture_count; |
758 }; | 766 }; |
759 | 767 |
760 | 768 |
761 class RegExpEngine: public AllStatic { | 769 class RegExpEngine: public AllStatic { |
762 public: | 770 public: |
763 static Handle<FixedArray> Compile(RegExpParseResult* input, | 771 static Handle<FixedArray> Compile(RegExpParseResult* input, |
764 RegExpNode** node_return, | 772 RegExpNode** node_return, |
765 bool ignore_case); | 773 bool ignore_case); |
766 static void DotPrint(const char* label, RegExpNode* node); | 774 static void DotPrint(const char* label, RegExpNode* node); |
767 }; | 775 }; |
768 | 776 |
769 | 777 |
770 } } // namespace v8::internal | 778 } } // namespace v8::internal |
771 | 779 |
772 #endif // V8_JSREGEXP_H_ | 780 #endif // V8_JSREGEXP_H_ |
OLD | NEW |