/*!
Parse arguments for {set}/{let}/{default}
434141
function parseSetFunction( $funcName, &$args, $tpl, &$text, &$text_len, &$cur_pos,
                               $relatedTemplateName, $startLine, $startColumn, $rootNamespace )
    {
        while ( $cur_pos < $text_len )
        {
            $dollarSignFound = false;

            // skip optional dollar sign
            if ( $text[$cur_pos] == '$' )
            {
                $dollarSignFound = true;
                $cur_pos++;
            }

            // parse variable name
            $wordEndPos = $this->ElementParser->identifierEndPosition( $tpl, $text, $cur_pos, $text_len );
            $varName = substr( $text, $cur_pos, $wordEndPos-$cur_pos );
            $cur_pos = $wordEndPos;

            if ( !$varName )
            {
                $this->showParseErrorMessage( $tpl, $text, $text_len, $cur_pos, $relatedTemplateName, $startLine, $startColumn,
                                              $funcName, 'Empty variable name' );
                return;
            }

            /*
             * If parameter 'name' or 'scope' was passed without dollar sign
             * change its name to '-name' or '-scope', respectively.
             * In this case it is treated specially in the {set}/{let}/{default} functions.
             */
            if ( !$dollarSignFound && ( $varName == 'name' || $varName == 'scope' ) )
                $varName = "-$varName";

            // skip whitespaces
            $cur_pos = $this->ElementParser->whitespaceEndPos( $tpl, $text, $cur_pos, $text_len );

            // if no value, assume boolean true
            if ( $cur_pos >= $text_len or
                 ( $text[$cur_pos] != '=' /*and preg_match( "/[ \t\r\n]/", $text[$cur_pos] )*/ ) )
            {
                unset( $var_data );
                $var_data = array();
                $args[$varName] = array( array( eZTemplate::TYPE_NUMERIC, // type
                                                true, // content
                                                false // debug
                                                ) );
                continue;
            }

            if ( $cur_pos >= $text_len )
                break;

            $cur_pos++;

            // skip whitespaces
            $cur_pos = $this->ElementParser->whitespaceEndPos( $tpl, $text, $cur_pos, $text_len );

            $args[$varName] = $this->ElementParser->parseVariableTag( $tpl, $relatedTemplateName, $text, $cur_pos, $cur_pos, $text_len, $rootNamespace );

            // skip whitespaces
            $cur_pos = $this->ElementParser->whitespaceEndPos( $tpl, $text, $cur_pos, $text_len );
        }
    }
1157991
function (options) {
        options = options || {};
        var qs = '';
        if (typeof options === 'string') {
            qs = options;
            options = this.parseOptions(qs);
        }

        for (var key in options) {
            if (!(key in DEFAULT_OPTIONS)) {
                throw new Error('No such option.');
            }
        }
        if (qs.length && !Object.keys(options).length) {
            throw new Error('Invalid argument syntax.');
        }

        this.options = extend(DEFAULT_OPTIONS, options);
    }
173094
function strictArgs (strictArgs) {
    // set default if value passed
    if (defined(strictArgs)) {
        immutable.defaultStrictArgs = strictArgs ? true : false
        // return immutable
        return ImmutableCore
    }
    // return default value
    return immutable.defaultStrictArgs
}
596354
function parse_predicates(Type) {

	//function first_letter_not_dollar(k) {
	//	return k[0] !== '$';
	//}

	function parse_data(opts) {
		debug.assert(opts).ignore(undefined).is('object');

		opts = opts || {};
		var datakey = get_predicate_datakey(Type);
		var res = {};
		ARRAY(Object.keys(opts)).forEach(function(i) {
			if(first_letter_is_dollar(i)) {
				// Parse top level properties
				parse_top_level_properties(res, opts, i);
			} else {
				// Parse meta properties
				parse_meta_properties(res, opts, datakey, i);
			}
		});
		return res;
	}

	return parse_data;
}
456035
function(F) {
        var validSet = [];
        for (var i = 0; i < F.length; i++) {
            if (F[i].isValid()) {
                validSet.push(F[i]);
            }
        }
        return validSet;
    }
60676
function createSet(values) {
    var set = new Set();
    Lazy(values || []).flatten().each(function(e) {
      set.add(e);
    });
    return set;
  }
556874
function parsePrimitives(info, name, value) {
  var index
  var length
  var result

  if (typeof value !== 'object' || !('length' in value)) {
    return parsePrimitive(info, name, value)
  }

  length = value.length
  index = -1
  result = []

  while (++index < length) {
    result[index] = parsePrimitive(info, name, value[index])
  }

  return result
}
483137
function parseArguments() {
  var args = [];

  expect('(');

  if (!match(')')) {
    while (index < length) {
      args.push(parseConditionalExpression());
      if (match(')')) {
        break;
      }
      expect(',');
    }
  }

  expect(')');

  return args;
}
757917
def convert_args_to_sets(f):
    
    @wraps(f)
    def wrapper(*args, **kwargs):
        args = (setify(x) for x in args)
        return f(*args, **kwargs)
    return wrapper
1157654
function _parseParams(params, defaults) {
  const options = {};
  const attrs = {};

  Utils.each(params, (value, key) => {
    const coerced = Utils.coerceType(value);

    if (Utils.has(defaults.options, key)) {
      options[key] = coerced;
    } else if (Utils.has(defaults.attrs, key)) {
      attrs[key] = coerced;
    }
  });

  return [options, attrs];
}
1225290
function parseEntities(value, options) {
  var settings = {}
  var option
  var key

  if (!options) {
    options = {}
  }

  for (key in defaults) {
    option = options[key]
    settings[key] =
      option === null || option === undefined ? defaults[key] : option
  }

  if (settings.position.indent || settings.position.start) {
    settings.indent = settings.position.indent || []
    settings.position = settings.position.start
  }

  return parse(value, settings)
}
1278618
function parse(params) {
  var opts = {};
  var tokens = params.split(/,(?=(?:[^"]|"[^"]*")*$)/);
  for (var i = 0, len = tokens.length; i < len; i++) {
    var param = /(\w+)=["]?([^"]+)["]?$/.exec(tokens[i])
    if (param) {
      opts[param[1]] = param[2];
    }
  }
  return opts;
}
548634
function parseArguments(args) {
        var defaultConfig = {
            stateKey: 'instances',
            instanceKey: 'id'
        };

        if (typeof args[0] === 'function') {
            return {
                callback: args[0],
                config: defaultConfig
            };
        } else {
            return {
                callback: args[1],
                config: Object.assign({}, defaultConfig, args[0])
            };
        }
    }
1009898
function set(property, value, defaultValue) {
    if (value === undefined) {
      if (defaultValue === undefined) {
        defaultValue = this.keys[property];
      }
      if (typeof defaultValue === 'function') {
        this[property] = defaultValue.call(this);
      } else {
        this[property] = defaultValue;
      }
    } else {
      this[property] = value;
    }
  }
461193
function _$set(kp, value, lazyEmit) {
        if (_destroy) return _destroyNotice()

        return _$sync(kp, value, lazyEmit)
        // if (!diff) return
        /**
         *  Base type change of object type will be trigger change event
         *  next and pre value are not keypath value but property value
         */
        // if ( kp == diff.mounted && $util.diff(diff.next, diff.pre) ) {
        //     var propname = diff.mounted
        //     // emit change immediately
        //     _emitChange(propname, diff.next, diff.pre)
        // }
    }
654435
function copyIfSet(src, dest, prop) {
	if (src[prop]) {
		dest[prop] = src[prop];
	}
}
659806
function handleSet(setFnName) {
  return function() {
    var args = Array.prototype.slice.call(arguments);
    return match(args, function(when) {
      when([
          function(sym) {
            return sym.value === setFnName;
          },
          match.var("key", match.any),
          match.var("arrayname", match.any),
          match.var("valexpr", match.any)
        ],
        function(vars) {
          return (function(key, arrayname, valexpr) {
            return sl.generated([
              this.x(arrayname), "[", this.x(key), "] = ", this.x(valexpr)
            ]);
          }).call(this, vars["key"], vars["arrayname"], vars["valexpr"]);
        }, this);
      when([
          function(sym) {
            return sym.value === setFnName;
          },
          match.var("varexpr", match.any),
          match.var("valexpr", match.any)
        ],
        function(vars) {
          return (function(varexpr, valexpr) {
            return sl.generated([
              this.x(varexpr), " = ", this.x(valexpr)
            ]);
          }).call(this, vars["varexpr"], vars["valexpr"]);
        }, this);
      when([
          match.var("any", match.lsdefault)
        ],
        function(vars) {
          return (function(any) {
            return this.error('invalid arguments for ' + setFnName);
          }).call(this, vars["any"]);
        }, this);
    }, this)
  };
}