Пример #1
0
module.exports = function(info) {
    var match;
    var path = info.path;
    var tags = [];
    var text = info.inputs.text;
    // Regular old functions
    while (match = FN_REGEX.exec(text)) {
        tags.push({
            path: path,
            symbol: match[1],
            locator: indexToLine(text, match.index)
        });
    }
    return symbol.updateSymbols(path, tags);
};
Пример #2
0
module.exports = function(info) {
    var match;
    var tags = [];
    var path = info.path;
    var text = info.inputs.text;
    // Classes and functions
    while (match = FN_REGEX.exec(text)) {
        //console.log(match);
        tags.push({
            symbol: match[2],
            locator: indexToLine(text, match.index),
            path: path
        });
    }
    return symbol.updateSymbols(path, tags);
};
Пример #3
0
module.exports = function(info) {
    var tags = [];
    var regexInfos = info.regexes;
    var path = info.path;
    var debug = info.debug;
    var text = info.inputs.text;
    var iterations = 0;
    // Regular old functions
    regexInfos.forEach(function(regexInfo) {
        var m;
        var regex = new RegExp(regexInfo.regex, "mg");
        if(debug) {
            console.log("Now searching for:", regexInfo.regex);
        }
        while (m = regex.exec(text)) {
            if(debug) {
                console.log("Got a match", m);
            }
            var symbol;
            if(regexInfo.expr) {
                symbol = eval(regexInfo.expr);
            } else {
                symbol = m[regexInfo.symbolIndex];
            }
            tags.push({
                path: path,
                symbol: symbol,
                locator: indexToLine(text, m.index),
                type: regexInfo.type
            });
            iterations++;
            if(iterations > 10000) {
                return console.error("Too many results, jumping out");
            }
        }

    });

    return symbol.updateSymbols(path, tags);
};