protected function parseAttributes()
	{
		$firstPos = $this->pos;
		$this->attributes = [];
		while ($this->pos < $this->textLen)
		{
			$c = $this->text[$this->pos];
			if (strpos(" \n\t", $c) !== false)
			{
				++$this->pos;
				continue;
			}
			if (strpos('/]', $c) !== false)
			{
				return;
			}

			// Capture the attribute name
			$spn = strspn($this->text, 'abcdefghijklmnopqrstuvwxyz_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-', $this->pos);
			if ($spn)
			{
				$attrName = strtolower(substr($this->text, $this->pos, $spn));
				$this->pos += $spn;
				if ($this->pos >= $this->textLen)
				{
					// The attribute name extends to the end of the text
					throw new RuntimeException;
				}
				if ($this->text[$this->pos] !== '=')
				{
					// It's an attribute name not followed by an equal sign, ignore it
					continue;
				}
			}
			elseif ($c === '=' && $this->pos === $firstPos)
			{
				// This is the default param, e.g. [quote=foo]
				$attrName = (isset($this->bbcodeConfig['defaultAttribute']))
				          ? $this->bbcodeConfig['defaultAttribute']
				          : strtolower($this->bbcodeName);
			}
			else
			{
				throw new RuntimeException;
			}

			// Move past the = and make sure we're not at the end of the text
			if (++$this->pos >= $this->textLen)
			{
				throw new RuntimeException;
			}

			$this->attributes[$attrName] = $this->parseAttributeValue();
		}
	}