function complete( out, repl, expression, alias, value ) {
	var args;
	var ast;
	var arg;
	var v;
	var i;

	// Get the list of argument types for the desired API:
	debug( 'Settings API: %s', alias );
	args = settingsAliasArgs( alias );

	// Parse the expression into an AST:
	debug( 'Expression: %s', expression );
	ast = parse( expression, AOPTS );

	// Check whether the argument which triggered TAB completion has a corresponding argument type which is completable:
	debug( 'Checking if argument is completable...' );
	arg = args[ ast.body[ 0 ].expression.arguments.length-1 ];
	if ( !arg ) {
		debug( 'Argument which triggered TAB completion is not completable.' );
		return '';
	}
	debug( 'Argument is completable.' );

	debug( 'Searching for completion candidates...' );
	for ( i = 0; i < SETTINGS_NAMES.length; i++ ) {
		v = SETTINGS_NAMES[ i ];
		if ( startsWith( v, value ) ) {
			debug( 'Found a completion: %s', v );
			out.push( v );
		} else {
			debug( '%s does not match filter %s. Skipping...', v, value );
		}
	}
	return value;
}
Completes a settings API expression.

@private
@param {Array} out - output array for storing completions
@param {REPL} repl - REPL instance
@param {string} expression - expression to complete
@param {string} alias - settings API alias
@param {string} value - value to complete
@returns {string} value filter