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 FINAL : public RegExpVisitor { | 861 class RegExpUnparser V8_FINAL : 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*, \ |
867 void* data) OVERRIDE; | 867 void* data) V8_OVERRIDE; |
868 FOR_EACH_REG_EXP_TREE_TYPE(MAKE_CASE) | 868 FOR_EACH_REG_EXP_TREE_TYPE(MAKE_CASE) |
869 #undef MAKE_CASE | 869 #undef MAKE_CASE |
870 private: | 870 private: |
871 StringStream* stream() { return &stream_; } | 871 StringStream* stream() { return &stream_; } |
872 HeapStringAllocator alloc_; | 872 HeapStringAllocator alloc_; |
873 StringStream stream_; | 873 StringStream stream_; |
874 Zone* zone_; | 874 Zone* zone_; |
875 }; | 875 }; |
876 | 876 |
877 | 877 |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1191 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value()); | 1191 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value()); |
1192 str = arr; | 1192 str = arr; |
1193 } else { | 1193 } else { |
1194 str = DoubleToCString(value_->Number(), buffer); | 1194 str = DoubleToCString(value_->Number(), buffer); |
1195 } | 1195 } |
1196 return factory->NewStringFromAscii(CStrVector(str)); | 1196 return factory->NewStringFromAscii(CStrVector(str)); |
1197 } | 1197 } |
1198 | 1198 |
1199 | 1199 |
1200 } } // namespace v8::internal | 1200 } } // namespace v8::internal |
OLD | NEW |