| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 }, | 101 }, |
| 102 | 102 |
| 103 /** | 103 /** |
| 104 * @param {string} text | 104 * @param {string} text |
| 105 * @param {function(string):boolean} isWordChar | 105 * @param {function(string):boolean} isWordChar |
| 106 * @param {function(string)} wordCallback | 106 * @param {function(string)} wordCallback |
| 107 */ | 107 */ |
| 108 textToWords: function(text, isWordChar, wordCallback) | 108 textToWords: function(text, isWordChar, wordCallback) |
| 109 { | 109 { |
| 110 var startWord = -1; | 110 var startWord = -1; |
| 111 for(var i = 0; i < text.length; ++i) { | 111 for (var i = 0; i < text.length; ++i) { |
| 112 if (!isWordChar(text.charAt(i))) { | 112 if (!isWordChar(text.charAt(i))) { |
| 113 if (startWord !== -1) | 113 if (startWord !== -1) |
| 114 wordCallback(text.substring(startWord, i)); | 114 wordCallback(text.substring(startWord, i)); |
| 115 startWord = -1; | 115 startWord = -1; |
| 116 } else if (startWord === -1) | 116 } else if (startWord === -1) |
| 117 startWord = i; | 117 startWord = i; |
| 118 } | 118 } |
| 119 if (startWord !== -1) | 119 if (startWord !== -1) |
| 120 wordCallback(text.substring(startWord)); | 120 wordCallback(text.substring(startWord)); |
| 121 }, | 121 }, |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 */ | 265 */ |
| 266 WebInspector.TokenizerFactory = function() { } | 266 WebInspector.TokenizerFactory = function() { } |
| 267 | 267 |
| 268 WebInspector.TokenizerFactory.prototype = { | 268 WebInspector.TokenizerFactory.prototype = { |
| 269 /** | 269 /** |
| 270 * @param {string} mimeType | 270 * @param {string} mimeType |
| 271 * @return {function(string, function(string, ?string, number, number))} | 271 * @return {function(string, function(string, ?string, number, number))} |
| 272 */ | 272 */ |
| 273 createTokenizer: function(mimeType) { } | 273 createTokenizer: function(mimeType) { } |
| 274 } | 274 } |
| OLD | NEW |