• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript eol.split函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中eol.split函数的典型用法代码示例。如果您正苦于以下问题:TypeScript split函数的具体用法?TypeScript split怎么用?TypeScript split使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了split函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: parse

    return function parse(contents, file) {
        let comments: TodoComment[] = [];

        split(contents).forEach(function(line, index) {
            let hashMatch = commentsRegex.exec(line);
            while (hashMatch) {
                const comment = prepareComment(hashMatch, index + 1, file);
                if (!comment) {
                    break;
                }
                comments.push(comment);
                hashMatch = commentsRegex.exec(line);
            }

            let multiLineMatch = multiLineRegex.exec(line);
            while (multiLineMatch) {
                const comment = prepareComment(multiLineMatch, index + 1, file);
                if (!comment) {
                    break;
                }
                comments.push(comment);
                multiLineMatch = multiLineRegex.exec(line);
            }
        });
        // sort by line number
        comments = comments.sort((a, b) => a.line - b.line);
        return comments;
    };
开发者ID:pgilad,项目名称:leasot,代码行数:28,代码来源:pascalParser.ts


示例2: parse

    return function parse(contents, file) {
        const comments: TodoComment[] = [];

        split(contents).forEach(function(line, index) {
            let bangCommentMatch = bangComment.exec(line);
            while (bangCommentMatch) {
                const comment = prepareComment(bangCommentMatch, index + 1, file);
                if (!comment) {
                    break;
                }
                comments.push(comment);
                bangCommentMatch = bangComment.exec(line);
            }

            let htmlCommentMatch = htmlComment.exec(line);
            while (htmlCommentMatch) {
                const comment = prepareComment(htmlCommentMatch, index + 1, file);
                if (!comment) {
                    break;
                }
                comments.push(comment);
                htmlCommentMatch = htmlComment.exec(line);
            }
        });
        return comments;
    };
开发者ID:pgilad,项目名称:leasot,代码行数:26,代码来源:twigParser.ts


示例3: getReport

function getReport(filename: string, reporter: ReporterName, parseOptions: ParseConfig) {
    parseOptions.filename = filename;

    const content = fs.readFileSync(filename, 'utf8');
    const comments = leasot.parse(content, parseOptions);
    const report = leasot.report(comments, reporter);
    return split(report);
}
开发者ID:pgilad,项目名称:leasot,代码行数:8,代码来源:reporter-spec.ts


示例4: getLineFromPos

// Bases on get-line-from-pos to support Windows as well
// See https://github.com/pgilad/get-line-from-pos/blob/master/index.js
function getLineFromPos(str: string, pos: number) {
    if (pos === 0) {
        return 1;
    }
    //adjust for negative pos
    if (pos < 0) {
        pos = str.length + pos;
    }
    const lines = split(str.substr(0, pos));
    return lines.length;
}
开发者ID:pgilad,项目名称:leasot,代码行数:13,代码来源:defaultParser.ts


示例5: parse

    return function parse(contents, file) {
        const comments: TodoComment[] = [];

        split(contents).forEach(function(line, index) {
            let match = rLineComment.exec(line);
            while (match) {
                const comment = prepareComment(match, index + 1, file);
                if (!comment) {
                    break;
                }
                comments.push(comment);
                match = rLineComment.exec(line);
            }
        });

        //look for block comments
        let match = rBlockComment.exec(contents);
        while (match) {
            if (!match || !match.length) {
                break;
            }
            //use first match as basis to look into todos/fixmes
            const baseMatch = match[0];
            // jshint loopfunc:true
            split(baseMatch).forEach(function(line, index) {
                let subMatch = rInnerBlock.exec(line);
                while (subMatch) {
                    const adjustedLine = getLineFromPos(contents, match.index) + index;
                    const comment = prepareComment(subMatch, adjustedLine, file);
                    if (!comment) {
                        break;
                    }
                    comments.push(comment);
                    subMatch = rInnerBlock.exec(line);
                }
            });
            match = rBlockComment.exec(contents);
        }

        return comments;
    };
开发者ID:pgilad,项目名称:leasot,代码行数:41,代码来源:defaultParser.ts


示例6: parse

    return function parse(contents, file) {
        const comments: TodoComment[] = [];

        split(contents).forEach(function(line, index) {
            const match = commentsRegex.exec(line);
            const comment = prepareComment(match, index + 1, file);
            if (!comment) {
                return;
            }
            comments.push(comment);
        });
        return comments;
    };
开发者ID:pgilad,项目名称:leasot,代码行数:13,代码来源:haskellParser.ts


示例7: parse

    return function parse(contents, file) {
        const comments: TodoComment[] = [];

        split(contents).forEach(function(line, index) {
            let hamlRubyCommentMatch = hamlRubyComment.exec(line);
            let hamlHtmlCommentMatch = hamlHtmlComment.exec(line);
            let erbCommentMatch = erbComment.exec(line);
            let htmlCommentMatch = htmlComment.exec(line);

            while (hamlRubyCommentMatch) {
                const comment = prepareComment(hamlRubyCommentMatch, index + 1, file);
                if (!comment) {
                    break;
                }
                comments.push(comment);
                hamlRubyCommentMatch = hamlRubyComment.exec(line);
            }

            while (hamlHtmlCommentMatch) {
                const comment = prepareComment(hamlHtmlCommentMatch, index + 1, file);
                if (!comment) {
                    break;
                }
                comments.push(comment);

                hamlHtmlCommentMatch = hamlHtmlComment.exec(line);
            }

            while (erbCommentMatch) {
                const comment = prepareComment(erbCommentMatch, index + 1, file);
                if (!comment) {
                    break;
                }
                comments.push(comment);
                erbCommentMatch = erbComment.exec(line);
            }

            while (htmlCommentMatch) {
                const comment = prepareComment(htmlCommentMatch, index + 1, file);
                if (!comment) {
                    break;
                }
                comments.push(comment);
                htmlCommentMatch = htmlComment.exec(line);
            }
        });
        return comments;
    };
开发者ID:pgilad,项目名称:leasot,代码行数:48,代码来源:hamlParser.ts


示例8: parse

    return function parse(contents, file) {
        const comments: TodoComment[] = [];

        split(contents).forEach(function(line, index) {
            let hashMatch = commentsRegex.exec(line);
            while (hashMatch) {
                const comment = prepareComment(hashMatch, index + 1, file);
                if (!comment) {
                    break;
                }
                comments.push(comment);
                hashMatch = commentsRegex.exec(line);
            }
        });
        return comments;
    };
开发者ID:pgilad,项目名称:leasot,代码行数:16,代码来源:erlangParser.ts


示例9: parse

    return function parse(contents, file) {
        const comments: TodoComment[] = [];

        split(contents).forEach(function(line, index) {
            let hashMatch = commentsRegex.exec(line);
            while (hashMatch) {
                const comment = prepareComment(hashMatch, index + 1, file);
                if (!comment) {
                    break;
                }
                comments.push(comment);
                hashMatch = commentsRegex.exec(line);
            }
        });
        // doing the multiline match outside of the loop because we need
        // multiple lines
        const multilineRegex = new RegExp(
            '^[ |\\t]*\\\\begin{comment}\\s*@?(todo|fixme)(?!\\w)\\s*(?:\\(([^)]*)\\))?\\s*:?\\s*((.*?)(?:\\s+([^\\s]+)\\s*)?)\\\\end{comment}',
            'gmi'
        );
        let m;
        while ((m = multilineRegex.exec(contents)) !== null) {
            // This is necessary to avoid infinite loops with zero-width matches
            if (m.index === multilineRegex.lastIndex) {
                multilineRegex.lastIndex++;
            }

            // Since we no longer know the line number as index, we have to
            // count it out. This could be inefficient for large files, so I
            // hope it doesn't become a performance problem
            const preceeding_lines = contents.slice(0, m.index);
            const line_no = preceeding_lines.split(/\r\n|\r|\n/).length;
            // Now prepare the comment
            const comment = prepareComment(m, line_no, file);
            comments.push(comment);
        }
        return comments;
    };
开发者ID:pgilad,项目名称:leasot,代码行数:38,代码来源:latexParser.ts


示例10: function

 cp.on('close', function(exitCode: number) {
     cb(exitCode, split(stripAnsi(chunks)));
 });
开发者ID:pgilad,项目名称:leasot,代码行数:3,代码来源:cli-spec.ts



注:本文中的eol.split函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript equatable.Comparer类代码示例发布时间:2022-05-25
下一篇:
TypeScript enzyme-to-json.default函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap