OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 bool RegExpCapture::IsAnchoredAtEnd() { | 851 bool RegExpCapture::IsAnchoredAtEnd() { |
852 return body()->IsAnchoredAtEnd(); | 852 return body()->IsAnchoredAtEnd(); |
853 } | 853 } |
854 | 854 |
855 | 855 |
856 // Convert regular expression trees to a simple sexp representation. | 856 // Convert regular expression trees to a simple sexp representation. |
857 // This representation should be different from the input grammar | 857 // This representation should be different from the input grammar |
858 // in as many cases as possible, to make it more difficult for incorrect | 858 // in as many cases as possible, to make it more difficult for incorrect |
859 // parses to look as correct ones which is likely if the input and | 859 // parses to look as correct ones which is likely if the input and |
860 // output formats are alike. | 860 // output formats are alike. |
861 class RegExpUnparser V8_FINAL : public RegExpVisitor { | 861 class RegExpUnparser: public RegExpVisitor { |
862 public: | 862 public: |
863 explicit RegExpUnparser(Zone* zone); | 863 explicit RegExpUnparser(Zone* zone); |
864 void VisitCharacterRange(CharacterRange that); | 864 void VisitCharacterRange(CharacterRange that); |
865 SmartArrayPointer<const char> ToString() { return stream_.ToCString(); } | 865 SmartArrayPointer<const char> ToString() { return stream_.ToCString(); } |
866 #define MAKE_CASE(Name) virtual void* Visit##Name(RegExp##Name*, \ | 866 #define MAKE_CASE(Name) virtual void* Visit##Name(RegExp##Name*, void* data); |
867 void* data) V8_OVERRIDE; | |
868 FOR_EACH_REG_EXP_TREE_TYPE(MAKE_CASE) | 867 FOR_EACH_REG_EXP_TREE_TYPE(MAKE_CASE) |
869 #undef MAKE_CASE | 868 #undef MAKE_CASE |
870 private: | 869 private: |
871 StringStream* stream() { return &stream_; } | 870 StringStream* stream() { return &stream_; } |
872 HeapStringAllocator alloc_; | 871 HeapStringAllocator alloc_; |
873 StringStream stream_; | 872 StringStream stream_; |
874 Zone* zone_; | 873 Zone* zone_; |
875 }; | 874 }; |
876 | 875 |
877 | 876 |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1191 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value()); | 1190 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value()); |
1192 str = arr; | 1191 str = arr; |
1193 } else { | 1192 } else { |
1194 str = DoubleToCString(value_->Number(), buffer); | 1193 str = DoubleToCString(value_->Number(), buffer); |
1195 } | 1194 } |
1196 return factory->NewStringFromAscii(CStrVector(str)); | 1195 return factory->NewStringFromAscii(CStrVector(str)); |
1197 } | 1196 } |
1198 | 1197 |
1199 | 1198 |
1200 } } // namespace v8::internal | 1199 } } // namespace v8::internal |
OLD | NEW |