function getLineData(code) {
    var lines = [];
    var lastPos = 0;
    LINE_SEPARATOR.lastIndex = 0;
    var match;
    while ((match = LINE_SEPARATOR.exec(code)) !== null) {
        var separatorLength = match[0].length;
        lines.push({
            line: code.slice(lastPos, match.index),
            separator: code.substr(match.index, separatorLength),
            offset: lastPos
        });
        lastPos = match.index + separatorLength;
    }
    lines.push({line: code.slice(lastPos), offset: lastPos, separator: ''});
    return lines;
}
Returns lines and line offsets for specified string.

@param {String} code
@returns {({line: String, offset: Number})[]}