• Модуль: webdav
  • Путь к файлу: ~/bitrix/modules/webdav/classes/general.php
  • Класс: CWebDavBase
  • Вызов: CWebDavBase::_if_header_lexer
function _if_header_lexer($string, &$pos)
{
	while (preg_match('/^s+$/', mb_substr($string, $pos, 1)))
	{
		++$pos;
	}

	if (mb_strlen($string) <= $pos)
	{
		return false;
	}

	$c = mb_substr($string, $pos++, 1);

	switch ($c)
	{
		case '<':
			$pos2 = mb_strpos($string, '>', $pos);
			$uri = mb_substr($string, $pos, $pos2 - $pos);
			$pos  = $pos2 + 1;
			return array('URI', $uri);
		case '[':
			if (mb_substr($string, $pos, 1) == 'W')
			{
				$type = 'ETAG_WEAK';
				$pos += 2;
			}
			else
			{
				$type = 'ETAG_STRONG';
			}
			$pos2 = mb_strpos($string, ']', $pos);
			$etag = mb_substr($string, $pos + 1, $pos2 - $pos - 2);
			$pos  = $pos2 + 1;
			return array($type, $etag);
		case 'N':
			$pos += 2;
			return array('NOT', 'Not');
		default:
			return array('CHAR', $c);
	}
}