(obj)
| 102 | } |
| 103 | |
| 104 | function stringify(obj) { |
| 105 | function replacer(key, obj) { |
| 106 | if (typeof obj == "function") { |
| 107 | var m = obj.toString().match(/function\s*[^\s(]*/); |
| 108 | return m ? m[0] : "function"; |
| 109 | } |
| 110 | return obj; |
| 111 | } |
| 112 | if (window.JSON && JSON.stringify) |
| 113 | return JSON.stringify(obj, replacer, 2); |
| 114 | return "[unsupported]"; // Fail safely if no native JSON. |
| 115 | } |
| 116 | |
| 117 | function highlight(string, mode) { |
| 118 | var state = mode.startState(); |