lib/nlp-parser.js
function getMatchingParenthesis(string, startPos) {
    var length = string.length;
    var bracket = 1;
    for (var i=startPos+1; i<=length; i++) {
        if (string[i] == '(') {
            bracket += 1;
        } else if (string[i] == ')') {
            bracket -= 1;
        }
        if (bracket == 0) {
            return i;
        }
    }
}
function getMatchingParenthesis(string, startPos) {
    var length = string.length;
    var bracket = 1;
    for (var i=startPos+1; i<=length; i++) {
        if (string[i] == '(') {
            bracket += 1;
        } else if (string[i] == ')') {
            bracket -= 1;
        }
        if (bracket == 0) {
            return i;
        }
    }
}
function getMatchingParenthesis ( string , startPos ) { var length = string . length ; var bracket = 1 ; for ( var i = startPos + 1 ; i <= length ; i ++ ) { if ( string [ i ] == '(' ) { bracket += 1 ; } else if ( string [ i ] == ')' ) { bracket -= 1 ; } if ( bracket == 0 ) { return i ; } } }
Find the position of a matching closing bracket for a string opening bracket
Find the position of a matching closing bracket for a string opening bracket