third_party/polymer2/bower_components/web-animations-js/src/handler-utils.js
function consumeParenthesised(parser, string) {
    var nesting = 0;
    for (var n = 0; n < string.length; n++) {
      if (/\s|,/.test(string[n]) && nesting == 0) {
        break;
      } else if (string[n] == '(') {
        nesting++;
      } else if (string[n] == ')') {
        nesting--;
        if (nesting == 0)
          n++;
        if (nesting <= 0)
          break;
      }
    }
    var parsed = parser(string.substr(0, n));
    return parsed == undefined ? undefined : [parsed, string.substr(n)];
  }
function consumeParenthesised(parser, string) {
    var nesting = 0;
    for (var n = 0; n < string.length; n++) {
      if (/\s|,/.test(string[n]) && nesting == 0) {
        break;
      } else if (string[n] == '(') {
        nesting++;
      } else if (string[n] == ')') {
        nesting--;
        if (nesting == 0)
          n++;
        if (nesting <= 0)
          break;
      }
    }
    var parsed = parser(string.substr(0, n));
    return parsed == undefined ? undefined : [parsed, string.substr(n)];
  }
function consumeParenthesised ( parser , string ) { var nesting = 0 ; for ( var n = 0 ; n < string . length ; n ++ ) { if ( / \s|, / . test ( string [ n ] ) && nesting == 0 ) { break ; } else if ( string [ n ] == '(' ) { nesting ++ ; } else if ( string [ n ] == ')' ) { nesting -- ; if ( nesting == 0 ) n ++ ; if ( nesting <= 0 ) break ; } } var parsed = parser ( string . substr ( 0 , n ) ) ; return parsed == undefined ? undefined : [ parsed , string . substr ( n ) ] ; }
Consumes a token or expression with balanced parentheses
Consumes a token or expression with balanced parentheses