protected function parseFunction(string $function, ?bool $namedParameters = null): array
	{
		if(strpos($function, '(') === false)
		{
			return [$function, []];
		}

		$function = $this->splitFunctionAndParameters($function);

		if($namedParameters === null)
		{
			$namedParameters = preg_match('/^"[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*"\s*:/', $function[1]) === 1;
		}

		$parameters = json_decode(($namedParameters ? '{' . $function[1] . '}' : '[' . $function[1] . ']'), true);

		if($parameters === null && json_last_error() !== JSON_ERROR_NONE)
		{
			throw new RuntimeException('Failed to decode function parameters.');
		}

		return [$function[0], $parameters];
	}