~rharding/loggerhead/yui3.7.1

« back to all changes in this revision

Viewing changes to loggerhead/static/javascript/yui/build/text-wordbreak/text-wordbreak-coverage.js

  • Committer: Rick Harding
  • Date: 2012-11-07 15:51:42 UTC
  • Revision ID: rick.harding@canonical.com-20121107155142-56lxp77hopixc9xf
Fix the collapsable

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
YUI 3.7.1 (build 5627)
 
3
Copyright 2012 Yahoo! Inc. All rights reserved.
 
4
Licensed under the BSD License.
 
5
http://yuilibrary.com/license/
 
6
*/
 
7
if (typeof _yuitest_coverage == "undefined"){
 
8
    _yuitest_coverage = {};
 
9
    _yuitest_coverline = function(src, line){
 
10
        var coverage = _yuitest_coverage[src];
 
11
        if (!coverage.lines[line]){
 
12
            coverage.calledLines++;
 
13
        }
 
14
        coverage.lines[line]++;
 
15
    };
 
16
    _yuitest_coverfunc = function(src, name, line){
 
17
        var coverage = _yuitest_coverage[src],
 
18
            funcId = name + ":" + line;
 
19
        if (!coverage.functions[funcId]){
 
20
            coverage.calledFunctions++;
 
21
        }
 
22
        coverage.functions[funcId]++;
 
23
    };
 
24
}
 
25
_yuitest_coverage["build/text-wordbreak/text-wordbreak.js"] = {
 
26
    lines: {},
 
27
    functions: {},
 
28
    coveredLines: 0,
 
29
    calledLines: 0,
 
30
    coveredFunctions: 0,
 
31
    calledFunctions: 0,
 
32
    path: "build/text-wordbreak/text-wordbreak.js",
 
33
    code: []
 
34
};
 
35
_yuitest_coverage["build/text-wordbreak/text-wordbreak.js"].code=["YUI.add('text-wordbreak', function (Y, NAME) {","","/**"," * Provides utility methods for splitting strings on word breaks and determining"," * whether a character index represents a word boundary."," *"," * @module text"," * @submodule text-wordbreak"," */","","/**"," * <p>"," * Provides utility methods for splitting strings on word breaks and determining"," * whether a character index represents a word boundary, using the generic word"," * breaking algorithm defined in the Unicode Text Segmentation guidelines"," * (<a href=\"http://unicode.org/reports/tr29/#Word_Boundaries\">Unicode Standard"," * Annex #29</a>)."," * </p>"," *"," * <p>"," * This algorithm provides a reasonable default for many languages. However, it"," * does not cover language or context specific requirements, and it does not"," * provide meaningful results at all for languages that don't use spaces between"," * words, such as Chinese, Japanese, Thai, Lao, Khmer, and others. Server-based"," * word breaking services usually provide significantly better results with"," * better performance."," * </p>"," *"," * @class Text.WordBreak"," * @static"," */","","var Text   = Y.Text,","    WBData = Text.Data.WordBreak,","","// Constants representing code point classifications.","ALETTER      = 0,","MIDNUMLET    = 1,","MIDLETTER    = 2,","MIDNUM       = 3,","NUMERIC      = 4,","CR           = 5,","LF           = 6,","NEWLINE      = 7,","EXTEND       = 8,","FORMAT       = 9,","KATAKANA     = 10,","EXTENDNUMLET = 11,","OTHER        = 12,","","// RegExp objects generated from code point data. Each regex matches a single","// character against a set of Unicode code points. The index of each item in","// this array must match its corresponding code point constant value defined","// above.","SETS = [","    new RegExp(WBData.aletter),","    new RegExp(WBData.midnumlet),","    new RegExp(WBData.midletter),","    new RegExp(WBData.midnum),","    new RegExp(WBData.numeric),","    new RegExp(WBData.cr),","    new RegExp(WBData.lf),","    new RegExp(WBData.newline),","    new RegExp(WBData.extend),","    new RegExp(WBData.format),","    new RegExp(WBData.katakana),","    new RegExp(WBData.extendnumlet)","],","","EMPTY_STRING = '',","PUNCTUATION  = new RegExp('^' + WBData.punctuation + '$'),","WHITESPACE   = /\\s/,","","WordBreak = {","    // -- Public Static Methods ------------------------------------------------","","    /**","     * Splits the specified string into an array of individual words.","     *","     * @method getWords","     * @param {String} string String to split.","     * @param {Object} options (optional) Options object containing zero or more","     *   of the following properties:","     *","     * <dl>","     *   <dt>ignoreCase (Boolean)</dt>","     *   <dd>","     *     If <code>true</code>, the string will be converted to lowercase","     *     before being split. Default is <code>false</code>.","     *   </dd>","     *","     *   <dt>includePunctuation (Boolean)</dt>","     *   <dd>","     *     If <code>true</code>, the returned array will include punctuation","     *     characters. Default is <code>false</code>.","     *   </dd>","     *","     *   <dt>includeWhitespace (Boolean)</dt>","     *   <dd>","     *     If <code>true</code>, the returned array will include whitespace","     *     characters. Default is <code>false</code>.","     *   </dd>","     * </dl>","     * @return {Array} Array of words.","     * @static","     */","    getWords: function (string, options) {","        var i     = 0,","            map   = WordBreak._classify(string),","            len   = map.length,","            word  = [],","            words = [],","            chr,","            includePunctuation,","            includeWhitespace;","","        if (!options) {","            options = {};","        }","","        if (options.ignoreCase) {","            string = string.toLowerCase();","        }","","        includePunctuation = options.includePunctuation;","        includeWhitespace  = options.includeWhitespace;","","        // Loop through each character in the classification map and determine","        // whether it precedes a word boundary, building an array of distinct","        // words as we go.","        for (; i < len; ++i) {","            chr = string.charAt(i);","","            // Append this character to the current word.","            word.push(chr);","","            // If there's a word boundary between the current character and the","            // next character, append the current word to the words array and","            // start building a new word. ","            if (WordBreak._isWordBoundary(map, i)) {","                word = word.join(EMPTY_STRING);","","                if (word &&","                        (includeWhitespace  || !WHITESPACE.test(word)) &&","                        (includePunctuation || !PUNCTUATION.test(word))) {","                    words.push(word);","                }","","                word = [];","            }","        }","","        return words;","    },","","    /**","     * Returns an array containing only unique words from the specified string.","     * For example, the string <code>'foo bar baz foo'</code> would result in","     * the array <code>['foo', 'bar', 'baz']</code>.","     *","     * @method getUniqueWords","     * @param {String} string String to split.","     * @param {Object} options (optional) Options (see <code>getWords()</code>","     *   for details).","     * @return {Array} Array of unique words.","     * @static","     */","    getUniqueWords: function (string, options) {","        return Y.Array.unique(WordBreak.getWords(string, options));","    },","","    /**","     * <p>","     * Returns <code>true</code> if there is a word boundary between the","     * specified character index and the next character index (or the end of the","     * string).","     * </p>","     *","     * <p>","     * Note that there are always word breaks at the beginning and end of a","     * string, so <code>isWordBoundary('', 0)</code> and","     * <code>isWordBoundary('a', 0)</code> will both return <code>true</code>.","     * </p>","     *","     * @method isWordBoundary","     * @param {String} string String to test.","     * @param {Number} index Character index to test within the string.","     * @return {Boolean} <code>true</code> for a word boundary,","     *   <code>false</code> otherwise.","     * @static","     */","    isWordBoundary: function (string, index) {","        return WordBreak._isWordBoundary(WordBreak._classify(string), index);","    },","","    // -- Protected Static Methods ---------------------------------------------","","    /**","     * Returns a character classification map for the specified string.","     *","     * @method _classify","     * @param {String} string String to classify.","     * @return {Array} Classification map.","     * @protected","     * @static","     */","    _classify: function (string) {","        var chr,","            map          = [],","            i            = 0,","            j,","            set,","            stringLength = string.length,","            setsLength   = SETS.length,","            type;","","        for (; i < stringLength; ++i) {","            chr  = string.charAt(i);","            type = OTHER;","","            for (j = 0; j < setsLength; ++j) {","                set = SETS[j];","","                if (set && set.test(chr)) {","                    type = j;","                    break;","                }","            }","","            map.push(type);","        }","","        return map;","    },","","    /**","     * <p>","     * Returns <code>true</code> if there is a word boundary between the","     * specified character index and the next character index (or the end of the","     * string).","     * </p>","     *","     * <p>","     * Note that there are always word breaks at the beginning and end of a","     * string, so <code>_isWordBoundary('', 0)</code> and","     * <code>_isWordBoundary('a', 0)</code> will both return <code>true</code>.","     * </p>","     *","     * @method _isWordBoundary","     * @param {Array} map Character classification map generated by","     *   <code>_classify</code>.","     * @param {Number} index Character index to test.","     * @return {Boolean}","     * @protected","     * @static","     */","    _isWordBoundary: function (map, index) {","        var prevType,","            type     = map[index],","            nextType = map[index + 1],","            nextNextType;","","        if (index < 0 || (index > map.length - 1 && index !== 0)) {","            return false;","        }","","        // WB5. Don't break between most letters.","        if (type === ALETTER && nextType === ALETTER) {","            return false;","        }","","        nextNextType = map[index + 2];","","        // WB6. Don't break letters across certain punctuation.","        if (type === ALETTER &&","                (nextType === MIDLETTER || nextType === MIDNUMLET) &&","                nextNextType === ALETTER) {","            return false;","        }","","        prevType = map[index - 1];","","        // WB7. Don't break letters across certain punctuation.","        if ((type === MIDLETTER || type === MIDNUMLET) &&","                nextType === ALETTER &&","                prevType === ALETTER) {","            return false;","        }","","        // WB8/WB9/WB10. Don't break inside sequences of digits or digits","        // adjacent to letters.","        if ((type === NUMERIC || type === ALETTER) &&","                (nextType === NUMERIC || nextType === ALETTER)) {","            return false;","        }","","        // WB11. Don't break inside numeric sequences like \"3.2\" or","        // \"3,456.789\".","        if ((type === MIDNUM || type === MIDNUMLET) &&","                nextType === NUMERIC &&","                prevType === NUMERIC) {","            return false;","        }","","        // WB12. Don't break inside numeric sequences like \"3.2\" or","        // \"3,456.789\".","        if (type === NUMERIC &&","                (nextType === MIDNUM || nextType === MIDNUMLET) &&","                nextNextType === NUMERIC) {","            return false;","        }","","        // WB4. Ignore format and extend characters.","        if (type === EXTEND || type === FORMAT ||","                prevType === EXTEND || prevType === FORMAT ||","                nextType === EXTEND || nextType === FORMAT) {","            return false;","        }","","        // WB3. Don't break inside CRLF.","        if (type === CR && nextType === LF) {","            return false;","        }","","        // WB3a. Break before newlines (including CR and LF).","        if (type === NEWLINE || type === CR || type === LF) {","            return true;","        }","","        // WB3b. Break after newlines (including CR and LF).","        if (nextType === NEWLINE || nextType === CR || nextType === LF) {","            return true;","        }","","        // WB13. Don't break between Katakana characters.","        if (type === KATAKANA && nextType === KATAKANA) {","            return false;","        }","","        // WB13a. Don't break from extenders.","        if (nextType === EXTENDNUMLET &&","                (type === ALETTER || type === NUMERIC || type === KATAKANA ||","                type === EXTENDNUMLET)) {","            return false;","        }","","        // WB13b. Don't break from extenders.","        if (type === EXTENDNUMLET &&","                (nextType === ALETTER || nextType === NUMERIC ||","                nextType === KATAKANA)) {","            return false;","        }","","        // Break after any character not covered by the rules above.","        return true;","    }","};","","Text.WordBreak = WordBreak;","","","}, '3.7.1', {\"requires\": [\"array-extras\", \"text-data-wordbreak\"]});"];
 
36
_yuitest_coverage["build/text-wordbreak/text-wordbreak.js"].lines = {"1":0,"33":0,"108":0,"117":0,"118":0,"121":0,"122":0,"125":0,"126":0,"131":0,"132":0,"135":0,"140":0,"141":0,"143":0,"146":0,"149":0,"153":0,"169":0,"193":0,"208":0,"217":0,"218":0,"219":0,"221":0,"222":0,"224":0,"225":0,"226":0,"230":0,"233":0,"258":0,"263":0,"264":0,"268":0,"269":0,"272":0,"275":0,"278":0,"281":0,"284":0,"287":0,"292":0,"294":0,"299":0,"302":0,"307":0,"310":0,"314":0,"317":0,"321":0,"322":0,"326":0,"327":0,"331":0,"332":0,"336":0,"337":0,"341":0,"344":0,"348":0,"351":0,"355":0,"359":0};
 
37
_yuitest_coverage["build/text-wordbreak/text-wordbreak.js"].functions = {"getWords:107":0,"getUniqueWords:168":0,"isWordBoundary:192":0,"_classify:207":0,"_isWordBoundary:257":0,"(anonymous 1):1":0};
 
38
_yuitest_coverage["build/text-wordbreak/text-wordbreak.js"].coveredLines = 64;
 
39
_yuitest_coverage["build/text-wordbreak/text-wordbreak.js"].coveredFunctions = 6;
 
40
_yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 1);
 
41
YUI.add('text-wordbreak', function (Y, NAME) {
 
42
 
 
43
/**
 
44
 * Provides utility methods for splitting strings on word breaks and determining
 
45
 * whether a character index represents a word boundary.
 
46
 *
 
47
 * @module text
 
48
 * @submodule text-wordbreak
 
49
 */
 
50
 
 
51
/**
 
52
 * <p>
 
53
 * Provides utility methods for splitting strings on word breaks and determining
 
54
 * whether a character index represents a word boundary, using the generic word
 
55
 * breaking algorithm defined in the Unicode Text Segmentation guidelines
 
56
 * (<a href="http://unicode.org/reports/tr29/#Word_Boundaries">Unicode Standard
 
57
 * Annex #29</a>).
 
58
 * </p>
 
59
 *
 
60
 * <p>
 
61
 * This algorithm provides a reasonable default for many languages. However, it
 
62
 * does not cover language or context specific requirements, and it does not
 
63
 * provide meaningful results at all for languages that don't use spaces between
 
64
 * words, such as Chinese, Japanese, Thai, Lao, Khmer, and others. Server-based
 
65
 * word breaking services usually provide significantly better results with
 
66
 * better performance.
 
67
 * </p>
 
68
 *
 
69
 * @class Text.WordBreak
 
70
 * @static
 
71
 */
 
72
 
 
73
_yuitest_coverfunc("build/text-wordbreak/text-wordbreak.js", "(anonymous 1)", 1);
 
74
_yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 33);
 
75
var Text   = Y.Text,
 
76
    WBData = Text.Data.WordBreak,
 
77
 
 
78
// Constants representing code point classifications.
 
79
ALETTER      = 0,
 
80
MIDNUMLET    = 1,
 
81
MIDLETTER    = 2,
 
82
MIDNUM       = 3,
 
83
NUMERIC      = 4,
 
84
CR           = 5,
 
85
LF           = 6,
 
86
NEWLINE      = 7,
 
87
EXTEND       = 8,
 
88
FORMAT       = 9,
 
89
KATAKANA     = 10,
 
90
EXTENDNUMLET = 11,
 
91
OTHER        = 12,
 
92
 
 
93
// RegExp objects generated from code point data. Each regex matches a single
 
94
// character against a set of Unicode code points. The index of each item in
 
95
// this array must match its corresponding code point constant value defined
 
96
// above.
 
97
SETS = [
 
98
    new RegExp(WBData.aletter),
 
99
    new RegExp(WBData.midnumlet),
 
100
    new RegExp(WBData.midletter),
 
101
    new RegExp(WBData.midnum),
 
102
    new RegExp(WBData.numeric),
 
103
    new RegExp(WBData.cr),
 
104
    new RegExp(WBData.lf),
 
105
    new RegExp(WBData.newline),
 
106
    new RegExp(WBData.extend),
 
107
    new RegExp(WBData.format),
 
108
    new RegExp(WBData.katakana),
 
109
    new RegExp(WBData.extendnumlet)
 
110
],
 
111
 
 
112
EMPTY_STRING = '',
 
113
PUNCTUATION  = new RegExp('^' + WBData.punctuation + '$'),
 
114
WHITESPACE   = /\s/,
 
115
 
 
116
WordBreak = {
 
117
    // -- Public Static Methods ------------------------------------------------
 
118
 
 
119
    /**
 
120
     * Splits the specified string into an array of individual words.
 
121
     *
 
122
     * @method getWords
 
123
     * @param {String} string String to split.
 
124
     * @param {Object} options (optional) Options object containing zero or more
 
125
     *   of the following properties:
 
126
     *
 
127
     * <dl>
 
128
     *   <dt>ignoreCase (Boolean)</dt>
 
129
     *   <dd>
 
130
     *     If <code>true</code>, the string will be converted to lowercase
 
131
     *     before being split. Default is <code>false</code>.
 
132
     *   </dd>
 
133
     *
 
134
     *   <dt>includePunctuation (Boolean)</dt>
 
135
     *   <dd>
 
136
     *     If <code>true</code>, the returned array will include punctuation
 
137
     *     characters. Default is <code>false</code>.
 
138
     *   </dd>
 
139
     *
 
140
     *   <dt>includeWhitespace (Boolean)</dt>
 
141
     *   <dd>
 
142
     *     If <code>true</code>, the returned array will include whitespace
 
143
     *     characters. Default is <code>false</code>.
 
144
     *   </dd>
 
145
     * </dl>
 
146
     * @return {Array} Array of words.
 
147
     * @static
 
148
     */
 
149
    getWords: function (string, options) {
 
150
        _yuitest_coverfunc("build/text-wordbreak/text-wordbreak.js", "getWords", 107);
 
151
_yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 108);
 
152
var i     = 0,
 
153
            map   = WordBreak._classify(string),
 
154
            len   = map.length,
 
155
            word  = [],
 
156
            words = [],
 
157
            chr,
 
158
            includePunctuation,
 
159
            includeWhitespace;
 
160
 
 
161
        _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 117);
 
162
if (!options) {
 
163
            _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 118);
 
164
options = {};
 
165
        }
 
166
 
 
167
        _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 121);
 
168
if (options.ignoreCase) {
 
169
            _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 122);
 
170
string = string.toLowerCase();
 
171
        }
 
172
 
 
173
        _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 125);
 
174
includePunctuation = options.includePunctuation;
 
175
        _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 126);
 
176
includeWhitespace  = options.includeWhitespace;
 
177
 
 
178
        // Loop through each character in the classification map and determine
 
179
        // whether it precedes a word boundary, building an array of distinct
 
180
        // words as we go.
 
181
        _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 131);
 
182
for (; i < len; ++i) {
 
183
            _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 132);
 
184
chr = string.charAt(i);
 
185
 
 
186
            // Append this character to the current word.
 
187
            _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 135);
 
188
word.push(chr);
 
189
 
 
190
            // If there's a word boundary between the current character and the
 
191
            // next character, append the current word to the words array and
 
192
            // start building a new word. 
 
193
            _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 140);
 
194
if (WordBreak._isWordBoundary(map, i)) {
 
195
                _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 141);
 
196
word = word.join(EMPTY_STRING);
 
197
 
 
198
                _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 143);
 
199
if (word &&
 
200
                        (includeWhitespace  || !WHITESPACE.test(word)) &&
 
201
                        (includePunctuation || !PUNCTUATION.test(word))) {
 
202
                    _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 146);
 
203
words.push(word);
 
204
                }
 
205
 
 
206
                _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 149);
 
207
word = [];
 
208
            }
 
209
        }
 
210
 
 
211
        _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 153);
 
212
return words;
 
213
    },
 
214
 
 
215
    /**
 
216
     * Returns an array containing only unique words from the specified string.
 
217
     * For example, the string <code>'foo bar baz foo'</code> would result in
 
218
     * the array <code>['foo', 'bar', 'baz']</code>.
 
219
     *
 
220
     * @method getUniqueWords
 
221
     * @param {String} string String to split.
 
222
     * @param {Object} options (optional) Options (see <code>getWords()</code>
 
223
     *   for details).
 
224
     * @return {Array} Array of unique words.
 
225
     * @static
 
226
     */
 
227
    getUniqueWords: function (string, options) {
 
228
        _yuitest_coverfunc("build/text-wordbreak/text-wordbreak.js", "getUniqueWords", 168);
 
229
_yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 169);
 
230
return Y.Array.unique(WordBreak.getWords(string, options));
 
231
    },
 
232
 
 
233
    /**
 
234
     * <p>
 
235
     * Returns <code>true</code> if there is a word boundary between the
 
236
     * specified character index and the next character index (or the end of the
 
237
     * string).
 
238
     * </p>
 
239
     *
 
240
     * <p>
 
241
     * Note that there are always word breaks at the beginning and end of a
 
242
     * string, so <code>isWordBoundary('', 0)</code> and
 
243
     * <code>isWordBoundary('a', 0)</code> will both return <code>true</code>.
 
244
     * </p>
 
245
     *
 
246
     * @method isWordBoundary
 
247
     * @param {String} string String to test.
 
248
     * @param {Number} index Character index to test within the string.
 
249
     * @return {Boolean} <code>true</code> for a word boundary,
 
250
     *   <code>false</code> otherwise.
 
251
     * @static
 
252
     */
 
253
    isWordBoundary: function (string, index) {
 
254
        _yuitest_coverfunc("build/text-wordbreak/text-wordbreak.js", "isWordBoundary", 192);
 
255
_yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 193);
 
256
return WordBreak._isWordBoundary(WordBreak._classify(string), index);
 
257
    },
 
258
 
 
259
    // -- Protected Static Methods ---------------------------------------------
 
260
 
 
261
    /**
 
262
     * Returns a character classification map for the specified string.
 
263
     *
 
264
     * @method _classify
 
265
     * @param {String} string String to classify.
 
266
     * @return {Array} Classification map.
 
267
     * @protected
 
268
     * @static
 
269
     */
 
270
    _classify: function (string) {
 
271
        _yuitest_coverfunc("build/text-wordbreak/text-wordbreak.js", "_classify", 207);
 
272
_yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 208);
 
273
var chr,
 
274
            map          = [],
 
275
            i            = 0,
 
276
            j,
 
277
            set,
 
278
            stringLength = string.length,
 
279
            setsLength   = SETS.length,
 
280
            type;
 
281
 
 
282
        _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 217);
 
283
for (; i < stringLength; ++i) {
 
284
            _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 218);
 
285
chr  = string.charAt(i);
 
286
            _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 219);
 
287
type = OTHER;
 
288
 
 
289
            _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 221);
 
290
for (j = 0; j < setsLength; ++j) {
 
291
                _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 222);
 
292
set = SETS[j];
 
293
 
 
294
                _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 224);
 
295
if (set && set.test(chr)) {
 
296
                    _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 225);
 
297
type = j;
 
298
                    _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 226);
 
299
break;
 
300
                }
 
301
            }
 
302
 
 
303
            _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 230);
 
304
map.push(type);
 
305
        }
 
306
 
 
307
        _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 233);
 
308
return map;
 
309
    },
 
310
 
 
311
    /**
 
312
     * <p>
 
313
     * Returns <code>true</code> if there is a word boundary between the
 
314
     * specified character index and the next character index (or the end of the
 
315
     * string).
 
316
     * </p>
 
317
     *
 
318
     * <p>
 
319
     * Note that there are always word breaks at the beginning and end of a
 
320
     * string, so <code>_isWordBoundary('', 0)</code> and
 
321
     * <code>_isWordBoundary('a', 0)</code> will both return <code>true</code>.
 
322
     * </p>
 
323
     *
 
324
     * @method _isWordBoundary
 
325
     * @param {Array} map Character classification map generated by
 
326
     *   <code>_classify</code>.
 
327
     * @param {Number} index Character index to test.
 
328
     * @return {Boolean}
 
329
     * @protected
 
330
     * @static
 
331
     */
 
332
    _isWordBoundary: function (map, index) {
 
333
        _yuitest_coverfunc("build/text-wordbreak/text-wordbreak.js", "_isWordBoundary", 257);
 
334
_yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 258);
 
335
var prevType,
 
336
            type     = map[index],
 
337
            nextType = map[index + 1],
 
338
            nextNextType;
 
339
 
 
340
        _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 263);
 
341
if (index < 0 || (index > map.length - 1 && index !== 0)) {
 
342
            _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 264);
 
343
return false;
 
344
        }
 
345
 
 
346
        // WB5. Don't break between most letters.
 
347
        _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 268);
 
348
if (type === ALETTER && nextType === ALETTER) {
 
349
            _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 269);
 
350
return false;
 
351
        }
 
352
 
 
353
        _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 272);
 
354
nextNextType = map[index + 2];
 
355
 
 
356
        // WB6. Don't break letters across certain punctuation.
 
357
        _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 275);
 
358
if (type === ALETTER &&
 
359
                (nextType === MIDLETTER || nextType === MIDNUMLET) &&
 
360
                nextNextType === ALETTER) {
 
361
            _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 278);
 
362
return false;
 
363
        }
 
364
 
 
365
        _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 281);
 
366
prevType = map[index - 1];
 
367
 
 
368
        // WB7. Don't break letters across certain punctuation.
 
369
        _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 284);
 
370
if ((type === MIDLETTER || type === MIDNUMLET) &&
 
371
                nextType === ALETTER &&
 
372
                prevType === ALETTER) {
 
373
            _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 287);
 
374
return false;
 
375
        }
 
376
 
 
377
        // WB8/WB9/WB10. Don't break inside sequences of digits or digits
 
378
        // adjacent to letters.
 
379
        _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 292);
 
380
if ((type === NUMERIC || type === ALETTER) &&
 
381
                (nextType === NUMERIC || nextType === ALETTER)) {
 
382
            _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 294);
 
383
return false;
 
384
        }
 
385
 
 
386
        // WB11. Don't break inside numeric sequences like "3.2" or
 
387
        // "3,456.789".
 
388
        _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 299);
 
389
if ((type === MIDNUM || type === MIDNUMLET) &&
 
390
                nextType === NUMERIC &&
 
391
                prevType === NUMERIC) {
 
392
            _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 302);
 
393
return false;
 
394
        }
 
395
 
 
396
        // WB12. Don't break inside numeric sequences like "3.2" or
 
397
        // "3,456.789".
 
398
        _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 307);
 
399
if (type === NUMERIC &&
 
400
                (nextType === MIDNUM || nextType === MIDNUMLET) &&
 
401
                nextNextType === NUMERIC) {
 
402
            _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 310);
 
403
return false;
 
404
        }
 
405
 
 
406
        // WB4. Ignore format and extend characters.
 
407
        _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 314);
 
408
if (type === EXTEND || type === FORMAT ||
 
409
                prevType === EXTEND || prevType === FORMAT ||
 
410
                nextType === EXTEND || nextType === FORMAT) {
 
411
            _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 317);
 
412
return false;
 
413
        }
 
414
 
 
415
        // WB3. Don't break inside CRLF.
 
416
        _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 321);
 
417
if (type === CR && nextType === LF) {
 
418
            _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 322);
 
419
return false;
 
420
        }
 
421
 
 
422
        // WB3a. Break before newlines (including CR and LF).
 
423
        _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 326);
 
424
if (type === NEWLINE || type === CR || type === LF) {
 
425
            _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 327);
 
426
return true;
 
427
        }
 
428
 
 
429
        // WB3b. Break after newlines (including CR and LF).
 
430
        _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 331);
 
431
if (nextType === NEWLINE || nextType === CR || nextType === LF) {
 
432
            _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 332);
 
433
return true;
 
434
        }
 
435
 
 
436
        // WB13. Don't break between Katakana characters.
 
437
        _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 336);
 
438
if (type === KATAKANA && nextType === KATAKANA) {
 
439
            _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 337);
 
440
return false;
 
441
        }
 
442
 
 
443
        // WB13a. Don't break from extenders.
 
444
        _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 341);
 
445
if (nextType === EXTENDNUMLET &&
 
446
                (type === ALETTER || type === NUMERIC || type === KATAKANA ||
 
447
                type === EXTENDNUMLET)) {
 
448
            _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 344);
 
449
return false;
 
450
        }
 
451
 
 
452
        // WB13b. Don't break from extenders.
 
453
        _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 348);
 
454
if (type === EXTENDNUMLET &&
 
455
                (nextType === ALETTER || nextType === NUMERIC ||
 
456
                nextType === KATAKANA)) {
 
457
            _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 351);
 
458
return false;
 
459
        }
 
460
 
 
461
        // Break after any character not covered by the rules above.
 
462
        _yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 355);
 
463
return true;
 
464
    }
 
465
};
 
466
 
 
467
_yuitest_coverline("build/text-wordbreak/text-wordbreak.js", 359);
 
468
Text.WordBreak = WordBreak;
 
469
 
 
470
 
 
471
}, '3.7.1', {"requires": ["array-extras", "text-data-wordbreak"]});