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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 return char === ")" || char === "}"; | 91 return char === ")" || char === "}"; |
92 }, | 92 }, |
93 | 93 |
94 /** | 94 /** |
95 * @param {string} char | 95 * @param {string} char |
96 * @return {boolean} | 96 * @return {boolean} |
97 */ | 97 */ |
98 isBraceChar: function(char) | 98 isBraceChar: function(char) |
99 { | 99 { |
100 return WebInspector.TextUtils.isOpeningBraceChar(char) || WebInspector.T
extUtils.isClosingBraceChar(char); | 100 return WebInspector.TextUtils.isOpeningBraceChar(char) || WebInspector.T
extUtils.isClosingBraceChar(char); |
101 } | 101 }, |
| 102 |
| 103 textToWords: function(text) |
| 104 { |
| 105 var words = []; |
| 106 var startWord = -1; |
| 107 for(var i = 0; i < text.length; ++i) { |
| 108 if (!WebInspector.TextUtils.isWordChar(text.charAt(i))) { |
| 109 if (startWord !== -1) |
| 110 words.push(text.substring(startWord, i)); |
| 111 startWord = -1; |
| 112 } else if (startWord === -1) |
| 113 startWord = i; |
| 114 } |
| 115 if (startWord !== -1) |
| 116 words.push(text.substring(startWord)); |
| 117 return words; |
| 118 }, |
102 } | 119 } |
103 | 120 |
104 WebInspector.TextUtils._SpaceCharRegex = /\s/; | 121 WebInspector.TextUtils._SpaceCharRegex = /\s/; |
105 | 122 |
106 /** | 123 /** |
107 * @enum {string} | 124 * @enum {string} |
108 */ | 125 */ |
109 WebInspector.TextUtils.Indent = { | 126 WebInspector.TextUtils.Indent = { |
110 TwoSpaces: " ", | 127 TwoSpaces: " ", |
111 FourSpaces: " ", | 128 FourSpaces: " ", |
112 EightSpaces: " ", | 129 EightSpaces: " ", |
113 TabCharacter: "\t" | 130 TabCharacter: "\t" |
114 } | 131 } |
OLD | NEW |