| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 #ifndef V8_JSON_PARSER_H_ | 5 #ifndef V8_JSON_PARSER_H_ |
| 6 #define V8_JSON_PARSER_H_ | 6 #define V8_JSON_PARSER_H_ |
| 7 | 7 |
| 8 #include "src/char-predicates.h" | 8 #include "src/char-predicates.h" |
| 9 #include "src/conversions.h" | 9 #include "src/conversions.h" |
| 10 #include "src/debug/debug.h" | 10 #include "src/debug/debug.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 position_ = position_ + length + 1; | 121 position_ = position_ + length + 1; |
| 122 AdvanceSkipWhitespace(); | 122 AdvanceSkipWhitespace(); |
| 123 return true; | 123 return true; |
| 124 } | 124 } |
| 125 } | 125 } |
| 126 } | 126 } |
| 127 return false; | 127 return false; |
| 128 } | 128 } |
| 129 | 129 |
| 130 Handle<String> ParseJsonInternalizedString() { | 130 Handle<String> ParseJsonInternalizedString() { |
| 131 return ScanJsonString<true>(); | 131 Handle<String> result = ScanJsonString<true>(); |
| 132 if (result.is_null()) return result; |
| 133 return factory()->InternalizeString(result); |
| 132 } | 134 } |
| 133 | 135 |
| 134 template <bool is_internalized> | 136 template <bool is_internalized> |
| 135 Handle<String> ScanJsonString(); | 137 Handle<String> ScanJsonString(); |
| 136 // Creates a new string and copies prefix[start..end] into the beginning | 138 // Creates a new string and copies prefix[start..end] into the beginning |
| 137 // of it. Then scans the rest of the string, adding characters after the | 139 // of it. Then scans the rest of the string, adding characters after the |
| 138 // prefix. Called by ScanJsonString when reaching a '\' or non-Latin1 char. | 140 // prefix. Called by ScanJsonString when reaching a '\' or non-Latin1 char. |
| 139 template <typename StringType, typename SinkChar> | 141 template <typename StringType, typename SinkChar> |
| 140 Handle<String> SlowScanJsonString(Handle<String> prefix, int start, int end); | 142 Handle<String> SlowScanJsonString(Handle<String> prefix, int start, int end); |
| 141 | 143 |
| (...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 835 DCHECK_EQ('"', c0_); | 837 DCHECK_EQ('"', c0_); |
| 836 // Advance past the last '"'. | 838 // Advance past the last '"'. |
| 837 AdvanceSkipWhitespace(); | 839 AdvanceSkipWhitespace(); |
| 838 return result; | 840 return result; |
| 839 } | 841 } |
| 840 | 842 |
| 841 } // namespace internal | 843 } // namespace internal |
| 842 } // namespace v8 | 844 } // namespace v8 |
| 843 | 845 |
| 844 #endif // V8_JSON_PARSER_H_ | 846 #endif // V8_JSON_PARSER_H_ |
| OLD | NEW |