Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663
This commit is contained in:
parent
eb34d130a8
commit
f32e58e4b1
8476 changed files with 211648 additions and 170042 deletions
vendor/symfony/css-selector/Parser/Tokenizer
78
vendor/symfony/css-selector/Parser/Tokenizer/Tokenizer.php
vendored
Normal file
78
vendor/symfony/css-selector/Parser/Tokenizer/Tokenizer.php
vendored
Normal file
|
@ -0,0 +1,78 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\CssSelector\Parser\Tokenizer;
|
||||
|
||||
use Symfony\Component\CssSelector\Parser\Handler;
|
||||
use Symfony\Component\CssSelector\Parser\Reader;
|
||||
use Symfony\Component\CssSelector\Parser\Token;
|
||||
use Symfony\Component\CssSelector\Parser\TokenStream;
|
||||
|
||||
/**
|
||||
* CSS selector tokenizer.
|
||||
*
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
*/
|
||||
class Tokenizer
|
||||
{
|
||||
/**
|
||||
* @var Handler\HandlerInterface[]
|
||||
*/
|
||||
private $handlers;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$patterns = new TokenizerPatterns();
|
||||
$escaping = new TokenizerEscaping($patterns);
|
||||
|
||||
$this->handlers = array(
|
||||
new Handler\WhitespaceHandler(),
|
||||
new Handler\IdentifierHandler($patterns, $escaping),
|
||||
new Handler\HashHandler($patterns, $escaping),
|
||||
new Handler\StringHandler($patterns, $escaping),
|
||||
new Handler\NumberHandler($patterns),
|
||||
new Handler\CommentHandler(),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tokenize selector source code.
|
||||
*
|
||||
* @param Reader $reader
|
||||
*
|
||||
* @return TokenStream
|
||||
*/
|
||||
public function tokenize(Reader $reader)
|
||||
{
|
||||
$stream = new TokenStream();
|
||||
|
||||
while (!$reader->isEOF()) {
|
||||
foreach ($this->handlers as $handler) {
|
||||
if ($handler->handle($reader, $stream)) {
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
|
||||
$stream->push(new Token(Token::TYPE_DELIMITER, $reader->getSubstring(1), $reader->getPosition()));
|
||||
$reader->moveForward(1);
|
||||
}
|
||||
|
||||
return $stream
|
||||
->push(new Token(Token::TYPE_FILE_END, null, $reader->getPosition()))
|
||||
->freeze();
|
||||
}
|
||||
}
|
82
vendor/symfony/css-selector/Parser/Tokenizer/TokenizerEscaping.php
vendored
Normal file
82
vendor/symfony/css-selector/Parser/Tokenizer/TokenizerEscaping.php
vendored
Normal file
|
@ -0,0 +1,82 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\CssSelector\Parser\Tokenizer;
|
||||
|
||||
/**
|
||||
* CSS selector tokenizer escaping applier.
|
||||
*
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
*/
|
||||
class TokenizerEscaping
|
||||
{
|
||||
/**
|
||||
* @var TokenizerPatterns
|
||||
*/
|
||||
private $patterns;
|
||||
|
||||
/**
|
||||
* @param TokenizerPatterns $patterns
|
||||
*/
|
||||
public function __construct(TokenizerPatterns $patterns)
|
||||
{
|
||||
$this->patterns = $patterns;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function escapeUnicode($value)
|
||||
{
|
||||
$value = $this->replaceUnicodeSequences($value);
|
||||
|
||||
return preg_replace($this->patterns->getSimpleEscapePattern(), '$1', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function escapeUnicodeAndNewLine($value)
|
||||
{
|
||||
$value = preg_replace($this->patterns->getNewLineEscapePattern(), '', $value);
|
||||
|
||||
return $this->escapeUnicode($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function replaceUnicodeSequences($value)
|
||||
{
|
||||
return preg_replace_callback($this->patterns->getUnicodeEscapePattern(), function ($match) {
|
||||
$c = hexdec($match[1]);
|
||||
|
||||
if (0x80 > $c %= 0x200000) {
|
||||
return chr($c);
|
||||
}
|
||||
if (0x800 > $c) {
|
||||
return chr(0xC0 | $c >> 6).chr(0x80 | $c & 0x3F);
|
||||
}
|
||||
if (0x10000 > $c) {
|
||||
return chr(0xE0 | $c >> 12).chr(0x80 | $c >> 6 & 0x3F).chr(0x80 | $c & 0x3F);
|
||||
}
|
||||
}, $value);
|
||||
}
|
||||
}
|
160
vendor/symfony/css-selector/Parser/Tokenizer/TokenizerPatterns.php
vendored
Normal file
160
vendor/symfony/css-selector/Parser/Tokenizer/TokenizerPatterns.php
vendored
Normal file
|
@ -0,0 +1,160 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\CssSelector\Parser\Tokenizer;
|
||||
|
||||
/**
|
||||
* CSS selector tokenizer patterns builder.
|
||||
*
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
|
||||
*/
|
||||
class TokenizerPatterns
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $unicodeEscapePattern;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $simpleEscapePattern;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $newLineEscapePattern;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $escapePattern;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $stringEscapePattern;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $nonAsciiPattern;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $nmCharPattern;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $nmStartPattern;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $identifierPattern;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $hashPattern;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $numberPattern;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $quotedStringPattern;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->unicodeEscapePattern = '\\\\([0-9a-f]{1,6})(?:\r\n|[ \n\r\t\f])?';
|
||||
$this->simpleEscapePattern = '\\\\(.)';
|
||||
$this->newLineEscapePattern = '\\\\(?:\n|\r\n|\r|\f)';
|
||||
$this->escapePattern = $this->unicodeEscapePattern.'|\\\\[^\n\r\f0-9a-f]';
|
||||
$this->stringEscapePattern = $this->newLineEscapePattern.'|'.$this->escapePattern;
|
||||
$this->nonAsciiPattern = '[^\x00-\x7F]';
|
||||
$this->nmCharPattern = '[_a-z0-9-]|'.$this->escapePattern.'|'.$this->nonAsciiPattern;
|
||||
$this->nmStartPattern = '[_a-z]|'.$this->escapePattern.'|'.$this->nonAsciiPattern;
|
||||
$this->identifierPattern = '(?:'.$this->nmStartPattern.')(?:'.$this->nmCharPattern.')*';
|
||||
$this->hashPattern = '#((?:'.$this->nmCharPattern.')+)';
|
||||
$this->numberPattern = '[+-]?(?:[0-9]*\.[0-9]+|[0-9]+)';
|
||||
$this->quotedStringPattern = '([^\n\r\f%s]|'.$this->stringEscapePattern.')*';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getNewLineEscapePattern()
|
||||
{
|
||||
return '~^'.$this->newLineEscapePattern.'~';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSimpleEscapePattern()
|
||||
{
|
||||
return '~^'.$this->simpleEscapePattern.'~';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getUnicodeEscapePattern()
|
||||
{
|
||||
return '~^'.$this->unicodeEscapePattern.'~i';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getIdentifierPattern()
|
||||
{
|
||||
return '~^'.$this->identifierPattern.'~i';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getHashPattern()
|
||||
{
|
||||
return '~^'.$this->hashPattern.'~i';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getNumberPattern()
|
||||
{
|
||||
return '~^'.$this->numberPattern.'~';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $quote
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getQuotedStringPattern($quote)
|
||||
{
|
||||
return '~^'.sprintf($this->quotedStringPattern, $quote).'~i';
|
||||
}
|
||||
}
|
Reference in a new issue