code: function parseFunction() {
    var args = mlutil.asArray.apply(null, arguments);
    var argLen = args.length;
    if (argLen < 2) {
      throw new Error('query parse function without module name or binding');
    }
  
    var moduleName = args[0];
  
    var constraintName = null;
    var termOptions = null;
    var arg = null;
    for (var i=1; i < args.length; i++) {
      arg = args[i];
      if (termOptions === null && arg instanceof TermOptionsDef) {
        termOptions = arg['term-option'];
        continue;
      }
      if (constraintName === null && arg instanceof BindDef) {
        constraintName = arg.constraintName;
        continue;
      }
      throw new Error('unknown argument for parse function: '+mlutil.identify(arg, true));
    }
  
    return new CustomConstraintDef(
        constraintName,
        new CustomOptionsDef(new CustomParserDef(moduleName), termOptions)
        );
  }
docs: The specification for a custom constraint parsing module as returned by
  {@link queryBuilder#parseFunction} to pass
  to the {@link queryBuilder#parseBindings} function.
  @typedef {object} queryBuilder.ParseFunction
  @since 1.0
   
  Specifies a custom constraint module that parses a tagged value as an argument
  to the {@link queryBuilder#parseBindings} function.
  The library must be installed as /ext/marklogic/query/custom/MODULE_NAME.xqy,
  must have the http://marklogic.com/query/custom/MODULE_NAME namespace, and
  must define the parse() function. The same module can implement start-facet()
  and finish-facet() functions for a custom facet specified with the
  {@link queryBuilder#calculateFunction} helper.
  @method
  @since 1.0
  @memberof queryBuilder#
  @param {string} moduleName - the name of the module with the function
  @param {queryBuilder.TermOptionsParam} [options] - options
  from {@link queryBuilder#termOptions} modifying the default behavior
  @returns {queryBuilder.ParseFunction} the specification for a custom parsing
  module for the {@link queryBuilder#parseBindings} function.