* * 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 * * @internal */ class Tokenizer { /** * @var Handler\HandlerInterface[] */ private $handlers; 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. * * @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(); } } __halt_compiler();----SIGNATURE:----N0VlGTG8F9bCJEIPGW9w2143zEiJqVIhK0MOINC0JLgtFKCglUPoPW11Mr1aCn5wYtyECb7o088zQiBlH/rgXivcRBpYbxbGqNLo5hdTDvcPJ4c/RJX+dIc42+/482ZNRr0TwENgzWyMRwKT0/aRaZREUvWp81jUwCqx3W6hoSE6ECjnT3DDDbAj0K5jdqe13h+1Wen2MjjoPzk2JPbXFpYEC3wn1VP03WcFnRYHKGp1ZpyZvbh+CJEPpEpuDjv7pCcbfGnxqXpheksCSfl8lR6yZPT881ahVMkaEktgX+M3fwL9Y3AO8ATH41pW1rRblhMCAkIahQGhNS1keBKHvGO331u/BjL4iPu5qNoo/ZA6ZFcnHzuRnoJ8EHy8DrrTV9OkWU+yoxSb+bhwemi6noY0lHo0UnCS4OSNB3gQOY3Cu7UrECRXL5ifn22zToVEsdp2BguU0x9hRDy3pt3uwb1c1/ekdjGJ8hf2c/Tc8Dv6FoJzwrqnlCkA+F/5ov+gLXrZPSuQ3sAvJiOouqPpi2jqy2mKycB0JOVqYWU/3bXYs4Pw7u4nhtazdZTbh/ru26kXoZ+J7TikldVraOGrpGdHDfcQwOxxbkgh/GFNLH8Q6NUGDx7axAte0iPauMvIiD5b8KAvAgvVUDR8rgK+psLI2NtH5pKJfEtTJj4TRNM=----ATTACHMENT:----ODU5NzI5ODMyODYwMzc5MCAxMjc5ODMyMjYzMTUxMDUgNTIyOTg3MTc1MTUxODczNg==