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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 return text === text.toUpperCase(); | 141 return text === text.toUpperCase(); |
142 }, | 142 }, |
143 | 143 |
144 /** | 144 /** |
145 * @param {string} text | 145 * @param {string} text |
146 * @return {boolean} | 146 * @return {boolean} |
147 */ | 147 */ |
148 isLowerCase: function(text) | 148 isLowerCase: function(text) |
149 { | 149 { |
150 return text === text.toLowerCase(); | 150 return text === text.toLowerCase(); |
| 151 }, |
| 152 |
| 153 _lastSectionBeforeQuery: function(text, delimiter) |
| 154 { |
| 155 var lastIndexOfDot = text.lastIndexOf(delimiter); |
| 156 var extension = lastIndexOfDot !== -1 ? text.substr(lastIndexOfDot + 1)
: ""; |
| 157 var indexOfQuestionMark = extension.indexOf("?"); |
| 158 if (indexOfQuestionMark !== -1) |
| 159 extension = extension.substr(0, indexOfQuestionMark); |
| 160 return extension; |
| 161 }, |
| 162 |
| 163 /** |
| 164 * @param {string} text |
| 165 * @return {string} |
| 166 */ |
| 167 extension: function(text) |
| 168 { |
| 169 return WebInspector.TextUtils._lastSectionBeforeQuery(text, "."); |
| 170 }, |
| 171 |
| 172 /** |
| 173 * @param {string} text |
| 174 * @return {string} |
| 175 */ |
| 176 fileName: function(text) |
| 177 { |
| 178 return WebInspector.TextUtils._lastSectionBeforeQuery(text, "/"); |
151 } | 179 } |
152 } | 180 } |
153 | 181 |
154 WebInspector.TextUtils._SpaceCharRegex = /\s/; | 182 WebInspector.TextUtils._SpaceCharRegex = /\s/; |
155 | 183 |
156 /** | 184 /** |
157 * @enum {string} | 185 * @enum {string} |
158 */ | 186 */ |
159 WebInspector.TextUtils.Indent = { | 187 WebInspector.TextUtils.Indent = { |
160 TwoSpaces: " ", | 188 TwoSpaces: " ", |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 */ | 260 */ |
233 WebInspector.TokenizerFactory = function() { } | 261 WebInspector.TokenizerFactory = function() { } |
234 | 262 |
235 WebInspector.TokenizerFactory.prototype = { | 263 WebInspector.TokenizerFactory.prototype = { |
236 /** | 264 /** |
237 * @param {string} mimeType | 265 * @param {string} mimeType |
238 * @return {function(string, function(string, ?string, number, number))} | 266 * @return {function(string, function(string, ?string, number, number))} |
239 */ | 267 */ |
240 createTokenizer: function(mimeType) { } | 268 createTokenizer: function(mimeType) { } |
241 } | 269 } |
OLD | NEW |