(text)
| 3937 | (function (TypeScript) { |
| 3938 | (function (TextUtilities) { |
| 3939 | function parseLineStarts(text) { |
| 3940 | var length = text.length(); |
| 3941 | |
| 3942 | if (0 === length) { |
| 3943 | var result = new Array(); |
| 3944 | result.push(0); |
| 3945 | return result; |
| 3946 | } |
| 3947 | |
| 3948 | var position = 0; |
| 3949 | var index = 0; |
| 3950 | var arrayBuilder = new Array(); |
| 3951 | var lineNumber = 0; |
| 3952 | |
| 3953 | while (index < length) { |
| 3954 | var c = text.charCodeAt(index); |
| 3955 | var lineBreakLength; |
| 3956 | |
| 3957 | if (c > 13 /* carriageReturn */ && c <= 127) { |
| 3958 | index++; |
| 3959 | continue; |
| 3960 | } else if (c === 13 /* carriageReturn */ && index + 1 < length && text.charCodeAt(index + 1) === 10 /* lineFeed */) { |
| 3961 | lineBreakLength = 2; |
| 3962 | } else if (c === 10 /* lineFeed */) { |
| 3963 | lineBreakLength = 1; |
| 3964 | } else { |
| 3965 | lineBreakLength = TextUtilities.getLengthOfLineBreak(text, index); |
| 3966 | } |
| 3967 | |
| 3968 | if (0 === lineBreakLength) { |
| 3969 | index++; |
| 3970 | } else { |
| 3971 | arrayBuilder.push(position); |
| 3972 | index += lineBreakLength; |
| 3973 | position = index; |
| 3974 | lineNumber++; |
| 3975 | } |
| 3976 | } |
| 3977 | |
| 3978 | arrayBuilder.push(position); |
| 3979 | |
| 3980 | return arrayBuilder; |
| 3981 | } |
| 3982 | TextUtilities.parseLineStarts = parseLineStarts; |
| 3983 | |
| 3984 | function getLengthOfLineBreakSlow(text, index, c) { |
nothing calls this directly
no test coverage detected