OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 23 matching lines...) Expand all Loading... |
34 * @param {!WebInspector.ParsedJSON} parsedJSON | 34 * @param {!WebInspector.ParsedJSON} parsedJSON |
35 */ | 35 */ |
36 WebInspector.JSONView = function(parsedJSON) | 36 WebInspector.JSONView = function(parsedJSON) |
37 { | 37 { |
38 WebInspector.VBox.call(this); | 38 WebInspector.VBox.call(this); |
39 this._parsedJSON = parsedJSON; | 39 this._parsedJSON = parsedJSON; |
40 this.element.classList.add("json-view"); | 40 this.element.classList.add("json-view"); |
41 } | 41 } |
42 | 42 |
43 // "false", "true", "null", ",", "{", "}", "[", "]", number, double-quoted strin
g. | 43 // "false", "true", "null", ",", "{", "}", "[", "]", number, double-quoted strin
g. |
44 WebInspector.JSONView._jsonToken = new RegExp('(?:false|true|null|[/*&\\|;=\\(\\
),\\{\\}\\[\\]]|(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)|
(?:\"(?:[^\\0-\\x08\\x0a-\\x1f\"\\\\]|\\\\(?:[\"/\\\\bfnrt]|u[0-9A-Fa-f]{4}))*\"
))', 'g'); | 44 WebInspector.JSONView._jsonToken = new RegExp('(?:false|true|null|[/*&\\|;=\\(\\
),\\{\\}\\[\\]]|(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)|
(?:\"(?:[^\\0-\\x08\\x0a-\\x1f\"\\\\]|\\\\(?:[\"/\\\\bfnrt]|u[0-9A-Fa-f]{4}))*\"
))', "g"); |
45 | 45 |
46 // Escaped unicode char. | 46 // Escaped unicode char. |
47 WebInspector.JSONView._escapedUnicode = new RegExp('\\\\(?:([^u])|u(.{4}))', 'g'
); | 47 WebInspector.JSONView._escapedUnicode = new RegExp("\\\\(?:([^u])|u(.{4}))", "g"
); |
48 | 48 |
49 // Map from escaped char to its literal value. | 49 // Map from escaped char to its literal value. |
50 WebInspector.JSONView._standardEscapes = {'"': '"', '/': '/', '\\': '\\', 'b': '
\b', 'f': '\f', 'n': '\n', 'r': '\r', 't': '\t'}; | 50 WebInspector.JSONView._standardEscapes = {'"': '"', "/": "/", "\\": "\\", "b": "
\b", "f": "\f", "n": "\n", "r": "\r", "t": "\t"}; |
51 | 51 |
52 /** | 52 /** |
53 * @param {string} full | 53 * @param {string} full |
54 * @param {string} standard | 54 * @param {string} standard |
55 * @param {string} unicode | 55 * @param {string} unicode |
56 * @return {string} | 56 * @return {string} |
57 */ | 57 */ |
58 WebInspector.JSONView._unescape = function(full, standard, unicode) | 58 WebInspector.JSONView._unescape = function(full, standard, unicode) |
59 { | 59 { |
60 return standard ? WebInspector.JSONView._standardEscapes[standard] : String.
fromCharCode(parseInt(unicode, 16)); | 60 return standard ? WebInspector.JSONView._standardEscapes[standard] : String.
fromCharCode(parseInt(unicode, 16)); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 * @param {*} data | 205 * @param {*} data |
206 * @param {string} prefix | 206 * @param {string} prefix |
207 * @param {string} suffix | 207 * @param {string} suffix |
208 */ | 208 */ |
209 WebInspector.ParsedJSON = function(data, prefix, suffix) | 209 WebInspector.ParsedJSON = function(data, prefix, suffix) |
210 { | 210 { |
211 this.data = data; | 211 this.data = data; |
212 this.prefix = prefix; | 212 this.prefix = prefix; |
213 this.suffix = suffix; | 213 this.suffix = suffix; |
214 } | 214 } |
OLD | NEW |