OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/ast.h" | 5 #include "src/ast.h" |
6 | 6 |
7 #include <cmath> // For isfinite. | 7 #include <cmath> // For isfinite. |
8 #include "src/builtins.h" | 8 #include "src/builtins.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/contexts.h" | 10 #include "src/contexts.h" |
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 bool RegExpCapture::IsAnchoredAtEnd() { | 784 bool RegExpCapture::IsAnchoredAtEnd() { |
785 return body()->IsAnchoredAtEnd(); | 785 return body()->IsAnchoredAtEnd(); |
786 } | 786 } |
787 | 787 |
788 | 788 |
789 // Convert regular expression trees to a simple sexp representation. | 789 // Convert regular expression trees to a simple sexp representation. |
790 // This representation should be different from the input grammar | 790 // This representation should be different from the input grammar |
791 // in as many cases as possible, to make it more difficult for incorrect | 791 // in as many cases as possible, to make it more difficult for incorrect |
792 // parses to look as correct ones which is likely if the input and | 792 // parses to look as correct ones which is likely if the input and |
793 // output formats are alike. | 793 // output formats are alike. |
794 class RegExpUnparser V8_FINAL : public RegExpVisitor { | 794 class RegExpUnparser FINAL : public RegExpVisitor { |
795 public: | 795 public: |
796 RegExpUnparser(OStream& os, Zone* zone) : os_(os), zone_(zone) {} | 796 RegExpUnparser(OStream& os, Zone* zone) : os_(os), zone_(zone) {} |
797 void VisitCharacterRange(CharacterRange that); | 797 void VisitCharacterRange(CharacterRange that); |
798 #define MAKE_CASE(Name) virtual void* Visit##Name(RegExp##Name*, \ | 798 #define MAKE_CASE(Name) virtual void* Visit##Name(RegExp##Name*, \ |
799 void* data) V8_OVERRIDE; | 799 void* data) OVERRIDE; |
800 FOR_EACH_REG_EXP_TREE_TYPE(MAKE_CASE) | 800 FOR_EACH_REG_EXP_TREE_TYPE(MAKE_CASE) |
801 #undef MAKE_CASE | 801 #undef MAKE_CASE |
802 private: | 802 private: |
803 OStream& os_; | 803 OStream& os_; |
804 Zone* zone_; | 804 Zone* zone_; |
805 }; | 805 }; |
806 | 806 |
807 | 807 |
808 void* RegExpUnparser::VisitDisjunction(RegExpDisjunction* that, void* data) { | 808 void* RegExpUnparser::VisitDisjunction(RegExpDisjunction* that, void* data) { |
809 os_ << "(|"; | 809 os_ << "(|"; |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1126 SNPrintF(buffer, "%d", Smi::cast(*value())->value()); | 1126 SNPrintF(buffer, "%d", Smi::cast(*value())->value()); |
1127 str = arr; | 1127 str = arr; |
1128 } else { | 1128 } else { |
1129 str = DoubleToCString(value()->Number(), buffer); | 1129 str = DoubleToCString(value()->Number(), buffer); |
1130 } | 1130 } |
1131 return isolate_->factory()->NewStringFromAsciiChecked(str); | 1131 return isolate_->factory()->NewStringFromAsciiChecked(str); |
1132 } | 1132 } |
1133 | 1133 |
1134 | 1134 |
1135 } } // namespace v8::internal | 1135 } } // namespace v8::internal |
OLD | NEW |