| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 769 ExternalTwoByteStringUC16CharacterStream stream( | 769 ExternalTwoByteStringUC16CharacterStream stream( |
| 770 Handle<ExternalTwoByteString>::cast(source), 0, source->length()); | 770 Handle<ExternalTwoByteString>::cast(source), 0, source->length()); |
| 771 return JsonParser().ParseJson(source, &stream); | 771 return JsonParser().ParseJson(source, &stream); |
| 772 } else { | 772 } else { |
| 773 GenericStringUC16CharacterStream stream(source, 0, source->length()); | 773 GenericStringUC16CharacterStream stream(source, 0, source->length()); |
| 774 return JsonParser().ParseJson(source, &stream); | 774 return JsonParser().ParseJson(source, &stream); |
| 775 } | 775 } |
| 776 } | 776 } |
| 777 | 777 |
| 778 private: | 778 private: |
| 779 JsonParser() : isolate_(Isolate::Current()), scanner_(isolate_) { } | 779 JsonParser() |
| 780 : isolate_(Isolate::Current()), |
| 781 scanner_(isolate_->scanner_constants()) { } |
| 780 ~JsonParser() { } | 782 ~JsonParser() { } |
| 781 | 783 |
| 782 Isolate* isolate() { return isolate_; } | 784 Isolate* isolate() { return isolate_; } |
| 783 | 785 |
| 784 // Parse a string containing a single JSON value. | 786 // Parse a string containing a single JSON value. |
| 785 Handle<Object> ParseJson(Handle<String> script, UC16CharacterStream* source); | 787 Handle<Object> ParseJson(Handle<String> script, UC16CharacterStream* source); |
| 786 // Parse a single JSON value from input (grammar production JSONValue). | 788 // Parse a single JSON value from input (grammar production JSONValue). |
| 787 // A JSON value is either a (double-quoted) string literal, a number literal, | 789 // A JSON value is either a (double-quoted) string literal, a number literal, |
| 788 // one of "true", "false", or "null", or an object or array literal. | 790 // one of "true", "false", or "null", or an object or array literal. |
| 789 Handle<Object> ParseJsonValue(); | 791 Handle<Object> ParseJsonValue(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 807 // Converts the currently parsed literal to a JavaScript String. | 809 // Converts the currently parsed literal to a JavaScript String. |
| 808 Handle<String> GetString(); | 810 Handle<String> GetString(); |
| 809 | 811 |
| 810 Isolate* isolate_; | 812 Isolate* isolate_; |
| 811 JsonScanner scanner_; | 813 JsonScanner scanner_; |
| 812 bool stack_overflow_; | 814 bool stack_overflow_; |
| 813 }; | 815 }; |
| 814 } } // namespace v8::internal | 816 } } // namespace v8::internal |
| 815 | 817 |
| 816 #endif // V8_PARSER_H_ | 818 #endif // V8_PARSER_H_ |
| OLD | NEW |