OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 position: startIndex + result.index, | 199 position: startIndex + result.index, |
200 regexIndex: regexIndex | 200 regexIndex: regexIndex |
201 }); | 201 }); |
202 currentIndex = result.index + match.length; | 202 currentIndex = result.index + match.length; |
203 } | 203 } |
204 var stringAfterMatches = text.substring(currentIndex); | 204 var stringAfterMatches = text.substring(currentIndex); |
205 if (stringAfterMatches) | 205 if (stringAfterMatches) |
206 doSplit(stringAfterMatches, regexIndex + 1, startIndex + current
Index); | 206 doSplit(stringAfterMatches, regexIndex + 1, startIndex + current
Index); |
207 } | 207 } |
208 } | 208 } |
209 } | 209 }; |
210 | 210 |
211 WebInspector.TextUtils._SpaceCharRegex = /\s/; | 211 WebInspector.TextUtils._SpaceCharRegex = /\s/; |
212 | 212 |
213 /** | 213 /** |
214 * @enum {string} | 214 * @enum {string} |
215 */ | 215 */ |
216 WebInspector.TextUtils.Indent = { | 216 WebInspector.TextUtils.Indent = { |
217 TwoSpaces: " ", | 217 TwoSpaces: " ", |
218 FourSpaces: " ", | 218 FourSpaces: " ", |
219 EightSpaces: " ", | 219 EightSpaces: " ", |
220 TabCharacter: "\t" | 220 TabCharacter: "\t" |
221 } | 221 }; |
222 | 222 |
223 /** | 223 /** |
224 * @constructor | 224 * @constructor |
225 * @param {function(string)} callback | 225 * @param {function(string)} callback |
226 * @param {boolean=} findMultiple | 226 * @param {boolean=} findMultiple |
227 */ | 227 */ |
228 WebInspector.TextUtils.BalancedJSONTokenizer = function(callback, findMultiple) | 228 WebInspector.TextUtils.BalancedJSONTokenizer = function(callback, findMultiple) |
229 { | 229 { |
230 this._callback = callback; | 230 this._callback = callback; |
231 this._index = 0; | 231 this._index = 0; |
232 this._balance = 0; | 232 this._balance = 0; |
233 this._buffer = ""; | 233 this._buffer = ""; |
234 this._findMultiple = findMultiple || false; | 234 this._findMultiple = findMultiple || false; |
235 this._closingDoubleQuoteRegex = /[^\\](?:\\\\)*"/g; | 235 this._closingDoubleQuoteRegex = /[^\\](?:\\\\)*"/g; |
236 } | 236 }; |
237 | 237 |
238 WebInspector.TextUtils.BalancedJSONTokenizer.prototype = { | 238 WebInspector.TextUtils.BalancedJSONTokenizer.prototype = { |
239 /** | 239 /** |
240 * @param {string} chunk | 240 * @param {string} chunk |
241 * @return {boolean} | 241 * @return {boolean} |
242 */ | 242 */ |
243 write: function(chunk) | 243 write: function(chunk) |
244 { | 244 { |
245 this._buffer += chunk; | 245 this._buffer += chunk; |
246 var lastIndex = this._buffer.length; | 246 var lastIndex = this._buffer.length; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 this._lastBalancedIndex = 0; | 285 this._lastBalancedIndex = 0; |
286 }, | 286 }, |
287 | 287 |
288 /** | 288 /** |
289 * @return {string} | 289 * @return {string} |
290 */ | 290 */ |
291 remainder: function() | 291 remainder: function() |
292 { | 292 { |
293 return this._buffer; | 293 return this._buffer; |
294 } | 294 } |
295 } | 295 }; |
296 | 296 |
297 /** | 297 /** |
298 * @interface | 298 * @interface |
299 */ | 299 */ |
300 WebInspector.TokenizerFactory = function() { } | 300 WebInspector.TokenizerFactory = function() { }; |
301 | 301 |
302 WebInspector.TokenizerFactory.prototype = { | 302 WebInspector.TokenizerFactory.prototype = { |
303 /** | 303 /** |
304 * @param {string} mimeType | 304 * @param {string} mimeType |
305 * @return {function(string, function(string, ?string, number, number))} | 305 * @return {function(string, function(string, ?string, number, number))} |
306 */ | 306 */ |
307 createTokenizer: function(mimeType) { } | 307 createTokenizer: function(mimeType) { } |
308 } | 308 }; |
OLD | NEW |