* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\CssSelector\Parser\Shortcut; use Symfony\Component\CssSelector\Node\ElementNode; use Symfony\Component\CssSelector\Node\HashNode; use Symfony\Component\CssSelector\Node\SelectorNode; use Symfony\Component\CssSelector\Parser\ParserInterface; /** * CSS selector hash parser shortcut. * * 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 HashParser implements ParserInterface { /** * {@inheritdoc} */ public function parse($source) { // Matches an optional namespace, optional element, and required id // $source = 'test|input#ab6bd_field'; // $matches = array (size=4) // 0 => string 'test|input#ab6bd_field' (length=22) // 1 => string 'test' (length=4) // 2 => string 'input' (length=5) // 3 => string 'ab6bd_field' (length=11) if (preg_match('/^(?:([a-z]++)\|)?+([\w-]++|\*)?+#([\w-]++)$/i', trim($source), $matches)) { return array( new SelectorNode(new HashNode(new ElementNode($matches[1] ?: null, $matches[2] ?: null), $matches[3])), ); } return array(); } } __halt_compiler();----SIGNATURE:----FIIgqY/AQ+ZI3iPOv3GEz+GaJaFMZ++MQ5crXTwnZEnIuTLWiTjQej94uT5oKg/gIMZRFUh8QP1dSJOz0/2UTmqrCuIlIKyg8UOd7cAQ1HdI+pbnWt9Pb1B71IHJy1YhMr1G4qZpYlLlQQ8qfGICOKkAyt2A5eChkE4mVQVN0OJ4+L+3jCedo8Fcuo6ckkM2Kg6msSB4MFCsi4gNIdRXi4ADktVZ3PYzX6zDSaE7+YD6//Fefcuk/ewipWLQ8VufvPYVm/YKnVpEk/qaJT5n7AqIag7xumzjuZTVIYfkkSTUKMU4GM72H6FZFxQGCIbHSb0Lzqa/S6Ov8d/80YEPiJi5PC7h0XYCped/XUAmyEsmlXmu4ZcLc1enZPTb6DlIIrMqvIrIYqbHCdvXseU56NcKGGWNzUD7mUiPMM3BHOSxeJtEnzS3LuRAh4FT2GXXuRyL+zakP6Q7pR6tFaZeHESAEWF+CvuCk1W3xw2lgesSbwbg7T6lct7WcrZpon4WQ5ZY7Qtrx3gubHDRfsoZeGEnKL5NVUFz3JUX29DAAkVOeo2EyeR2iWLTDkkOkuIXyjchVTTv7Za92vlNnU2ocvKupTWh0gLwxpM62ytN5Eavoa5uxOwKONe92HDEAOYprJ/ieLWdrPgNllDre77Au9Ul4EMPBYMrjshZxYPtIyg=----ATTACHMENT:----NDQ0NDI2NzM5NTk3MDg4OSA5MjE4MzY0MDE3MjU0MTQxIDExMjg1MzQyOTI0OTc3MzE=