OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 default: | 283 default: |
284 return ReportUnexpectedCharacter(); | 284 return ReportUnexpectedCharacter(); |
285 } | 285 } |
286 } | 286 } |
287 | 287 |
288 | 288 |
289 // Parse a JSON object. Position must be right at '{'. | 289 // Parse a JSON object. Position must be right at '{'. |
290 template <bool seq_ascii> | 290 template <bool seq_ascii> |
291 Handle<Object> JsonParser<seq_ascii>::ParseJsonObject() { | 291 Handle<Object> JsonParser<seq_ascii>::ParseJsonObject() { |
292 Handle<JSFunction> object_constructor( | 292 Handle<JSFunction> object_constructor( |
293 isolate()->global_context()->object_function()); | 293 isolate()->native_context()->object_function()); |
294 Handle<JSObject> json_object = | 294 Handle<JSObject> json_object = |
295 isolate()->factory()->NewJSObject(object_constructor); | 295 isolate()->factory()->NewJSObject(object_constructor); |
296 ASSERT_EQ(c0_, '{'); | 296 ASSERT_EQ(c0_, '{'); |
297 | 297 |
298 AdvanceSkipWhitespace(); | 298 AdvanceSkipWhitespace(); |
299 if (c0_ != '}') { | 299 if (c0_ != '}') { |
300 do { | 300 do { |
301 if (c0_ != '"') return ReportUnexpectedCharacter(); | 301 if (c0_ != '"') return ReportUnexpectedCharacter(); |
302 Handle<String> key = ParseJsonSymbol(); | 302 Handle<String> key = ParseJsonSymbol(); |
303 if (key.is_null() || c0_ != ':') return ReportUnexpectedCharacter(); | 303 if (key.is_null() || c0_ != ':') return ReportUnexpectedCharacter(); |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 } | 595 } |
596 ASSERT_EQ('"', c0_); | 596 ASSERT_EQ('"', c0_); |
597 // Advance past the last '"'. | 597 // Advance past the last '"'. |
598 AdvanceSkipWhitespace(); | 598 AdvanceSkipWhitespace(); |
599 return result; | 599 return result; |
600 } | 600 } |
601 | 601 |
602 } } // namespace v8::internal | 602 } } // namespace v8::internal |
603 | 603 |
604 #endif // V8_JSON_PARSER_H_ | 604 #endif // V8_JSON_PARSER_H_ |
OLD | NEW |