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/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/char-predicates-inl.h" | 10 #include "src/char-predicates-inl.h" |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 Handle<Object> name = factory->LookupSingleCharacterStringFromCode(c0_); | 237 Handle<Object> name = factory->LookupSingleCharacterStringFromCode(c0_); |
238 Handle<FixedArray> element = factory->NewFixedArray(1); | 238 Handle<FixedArray> element = factory->NewFixedArray(1); |
239 element->set(0, *name); | 239 element->set(0, *name); |
240 array = factory->NewJSArrayWithElements(element); | 240 array = factory->NewJSArrayWithElements(element); |
241 break; | 241 break; |
242 } | 242 } |
243 | 243 |
244 MessageLocation location(factory->NewScript(source_), | 244 MessageLocation location(factory->NewScript(source_), |
245 position_, | 245 position_, |
246 position_ + 1); | 246 position_ + 1); |
247 Handle<Object> error; | 247 Handle<Object> error = factory->NewSyntaxError(message, array); |
248 ASSIGN_RETURN_ON_EXCEPTION(isolate(), error, | |
249 factory->NewSyntaxError(message, array), Object); | |
250 return isolate()->template Throw<Object>(error, &location); | 248 return isolate()->template Throw<Object>(error, &location); |
251 } | 249 } |
252 return result; | 250 return result; |
253 } | 251 } |
254 | 252 |
255 | 253 |
256 // Parse any JSON value. | 254 // Parse any JSON value. |
257 template <bool seq_one_byte> | 255 template <bool seq_one_byte> |
258 Handle<Object> JsonParser<seq_one_byte>::ParseJsonValue() { | 256 Handle<Object> JsonParser<seq_one_byte>::ParseJsonValue() { |
259 StackLimitCheck stack_check(isolate_); | 257 StackLimitCheck stack_check(isolate_); |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 | 806 |
809 DCHECK_EQ('"', c0_); | 807 DCHECK_EQ('"', c0_); |
810 // Advance past the last '"'. | 808 // Advance past the last '"'. |
811 AdvanceSkipWhitespace(); | 809 AdvanceSkipWhitespace(); |
812 return result; | 810 return result; |
813 } | 811 } |
814 | 812 |
815 } } // namespace v8::internal | 813 } } // namespace v8::internal |
816 | 814 |
817 #endif // V8_JSON_PARSER_H_ | 815 #endif // V8_JSON_PARSER_H_ |
OLD | NEW |