function _parseParenthesizedSubformula(self, currentString) {
  if (currentString.charAt(0) !== '(') {
    return null;
  }

  const parsedSubformula = _parseFormula(self, sliceSymbol(currentString, '('), MIN_PRECEDENCE);
  if (parsedSubformula.remainder.charAt(0) !== ')') {
    throw new SyntaxError('Invalid formula! Found unmatched parenthesis.');
  }

  return {
    json: parsedSubformula.json,
    remainder: sliceSymbol(parsedSubformula.remainder, ')')
  };
}
/**
 * Attempts to parse a parenthesized subformula at the head of a given string.
 * Returns an AST node and string remainder if successful, otherwise null.
 *
 * @private
 * @param {FormulaParser} self
 * @param {string}        currentString - remainder of input string left to parse
 * @returns {?Object}
 */
Attempts to parse a parenthesized subformula at the head of a given string.
Returns an AST node and string remainder if successful, otherwise null.

@private
@param {FormulaParser} self
@param {string}        currentString - remainder of input string left to parse
@returns {?Object}
Attempts to parse a parenthesized subformula at the head of a given string . Returns an AST node and string remainder if successful otherwise null . @private @param { FormulaParser } self @param { string } currentString - remainder of input string left to parse @returns { ?Object }
function _parseParenthesizedSubformula(self, currentString) {
  if (currentString.charAt(0) !== '(') {
    return null;
  }
  const parsedSubformula = _parseFormula(self, sliceSymbol(currentString, '('), MIN_PRECEDENCE);
  if (parsedSubformula.remainder.charAt(0) !== ')') {
    throw new SyntaxError('Invalid formula! Found unmatched parenthesis.');
  }
  return {
    json: parsedSubformula.json,
    remainder: sliceSymbol(parsedSubformula.remainder, ')')
  };
}
function _parseParenthesizedSubformula ( self , currentString ) { if ( currentString . charAt ( 0 ) !== '(' ) { return null ; } const parsedSubformula = _parseFormula ( self , sliceSymbol ( currentString , '(' ) , MIN_PRECEDENCE ) ; if ( parsedSubformula . remainder . charAt ( 0 ) !== ')' ) { throw new SyntaxError ( 'Invalid formula! Found unmatched parenthesis.' ) ; } return { json : parsedSubformula . json , remainder : sliceSymbol ( parsedSubformula . remainder , ')' ) } ; }
Attempts to parse a parenthesized subformula at the head of a given string.
Attempts to parse a parenthesized subformula at the head of a given string .