�PNG  IHDR22?�� pHYs  �� OiCCPPhotoshop ICC profilexڝSgTS�=���BK���KoR RB���&*! J�!��Q�EEȠ�����Q, � ��!���������{�kּ������>���� �H3Q5� �B�������.@� $p�d!s�#�~<<+"��x� �M��0���B�\���t�8K�@z�B�@F���&S�`�cb�P-`'������{[�!�� e�Dh;��V�EX0fK�9�-0IWfH���� � 0Q��){`�##x��F�W<�+��*x��<�$9E�[-qWW.(�I+6aa�@.�y�2�4���������x����6��_-��"bb���ϫp@�t~��,/��;�m��%�h^ �u��f�@����W�p�~<�5�j>{�-�]c�K'Xt����o��(�h���w��?�G�%�fI�q^D$.Tʳ?�D��*�A��,���� �`6�B$��BB d�r`)��B(�Ͱ*`/�@4�Qh��p.�U�=p�a��(�� A�a!ڈb�X#����!�H�$ ɈQ"K�5H1R�T UH�=r9�\F��;�2����G1���Q=� �C��7�F� �dt1�����r�=�6��Ыhڏ>C�0��3�l0.��B�8, �c˱"� ���V����cϱw�E� 6wB aAHXLXN�H� $4� 7 �Q�'"��K�&���b21�XH,#��/{�C�7$�C2'��I��T��F�nR#�,��4H#���dk�9�, +ȅ����3��!�[ �b@q��S�(R�jJ��4�e�2AU��Rݨ�T5�ZB���R�Q��4u�9̓IK�����hh�i��t�ݕN��W���G���w ��Ljg(�gw��L�Ӌ�T071���oUX*�*|�� �J�&�*/T����ު U�U�T��^S}�FU3S� Ԗ�U��P�SSg�;���g�oT?�~Y��Y�L�OC�Q��_�� c�x,!k ��u�5�&���|v*�����=���9C3J3W�R�f?�q��tN �(���~���)�)�4L�1e\k����X�H�Q�G�6������E�Y��A�J'\'Gg����S�Sݧ �M=:��.�k���Dw�n��^��Lo��y���}/�T�m���G X� $� �<�5qo</���QC]�@C�a�a�ᄑ��<��F�F�i�\�$�m�mƣ&&!&KM�M�RM��)�;L;L���͢�֙5�=1�2��כ߷`ZxZ,����eI��Z�Yn�Z9Y�XUZ]�F���%ֻ�����N�N���gð�ɶ�����ۮ�m�}agbg�Ů��}�}��= ���Z~s�r:V:ޚΜ�?}����/gX���3��)�i�S��Ggg�s�󈋉K��.�>.���Ƚ�Jt�q]�z���������ۯ�6�i�ܟ�4�)�Y3s���C�Q��? ��0k߬~OCO�g��#/c/�W�װ��w��a�>�>r��>�<7�2�Y_�7��ȷ�O�o�_��C#�d�z����%g��A�[��z|!��?:�e����A���AA�������!h�쐭!��Α�i�P~���a�a��~ '���W�?�p�X�1�5w��Cs�D�D�Dޛg1O9�-J5*>�.j<�7�4�?�.fY��X�XIlK9.*�6nl������� �{�/�]py�����.,:�@L�N8��A*��%�w%� y��g"/�6ш�C\*N�H*Mz�쑼5y$�3�,幄'���L Lݛ:��v m2=:�1����qB�!M��g�g�fvˬe����n��/��k���Y- �B��TZ(�*�geWf�͉�9���+��̳�ې7�����ᒶ��KW-X潬j9�������(�x��oʿ�ܔ���Ĺd�f�f���-�[����n �ڴ �V����E�/��(ۻ��C���<��e����;?T�T�T�T6��ݵa��n��{��4���[���>ɾ�UUM�f�e�I���?�������m]�Nmq����#�׹���=TR��+�G�����w- 6 U����#pDy��� �� :�v�{���vg/jB��F�S��[b[�O�>����z�G��499�?r����C�d�&����ˮ/~�����јѡ�򗓿m|������������x31^�V���w�w��O�| (�h���SЧ��������c3-� cHRMz%������u0�`:�o�_�F5IDATx��ytUս�?�;���fN$$��@B�!�k��� -*�gE���j�O�kQ�ʠ`U�B_ �AÐ0%�Ȕ�@r3ޛ;߳��$�@��v����^�s����������$��ߢ !�W��5�̱'-٘������4�>�Rƫ$�G��0U�H}�_ _� #��k�MJ/=�9Du *ڲ�k�PQ;0��j|�*�$�^컂脛y���>�z×� B��� ��(�:$�ʔ_�6��C!B����MVx��a��ζyY����j��ƋY2�9�F�{r��r�딟F��Q��hY6��� x��[l��RC��������nt@��;P��3��� F�w��7��:�P���ɋ'���mj���Bƪ�$�Q�L��y��߷g��\���z����v5�p�v$�v櫻�`6~K �Y�X����,�:��"�o�e0II"(��,������l_�C���/4�+f�E�!q��:����u����c��樼.UE�@� �]K�W���$-�h]�JG���Dz)�`��.�A/ ���mᏣc�3jK� �!�>���$�Q�!�_�? \�C2(E �M$Z I{�U���s�ǣ���=��@Բe ޻��W�����@ �w����}�9v,)��.}*|"�s��di���,���G�]W�AC�������|<����[��ߕ������K�*�G nߴ!��‹��J�!��6(L�a)��Am��������;adf��:�xm��nh�;֦I��(���o�C~ډa?�=��s����h��E������xp����)���_���t��W�����´;8���`dz=(��@@�+,�;�`�fhl��XȌ�3,uI�~z(J����� �ZX�A����H'�À�㜦�82|��a�n�z2��I���� ���EY�h�ε<�0�q�{��C��v�˅��?"@��χ�x�WS+��N�~�KQ�J�8ل�� _.W��� !TU{�����,��"�� �;�������HI S� ��))�o�1�H�D� ���� (� ;����"Ҕ��,���� �F=���O��&�Ph>�`���y��߲ &S��P�<��'��1s�1cĂ�N����2)����@�u��tv��<�+�-&�����h��[!FSG���' � z z0��<����8d&�����E0�,��<��"!P�b4��� �{S�����X����.�囤���T��hEF��X�q0"-<����h���]�Py*����F⩍��@v�˂�Y08�� .q��a��s����(!<̫1�3�L�H��7sYW�`��qtu�\7��?�@�Y�� %Ka�x�GZ�*W�P��y�����N0r9��Z�c�%���q,��k�����!!,��>���IB��� �x1�Xu�Y���v-���ֺ��N������JP��a�2`�e5��w��u;�6�i���̃��(K���ťa��(l51��JL��O'%���]���ٖ뿉!��{*�p+f ���i8��D�ȑ���ܩ�M��V��ӟz��x�7Z�1i}�^͜���6e����x��)u�d�ˏ�V�eG�\�X1�����=n�U'�~Y����L�\,�(d!x ,�:�TW8� M`r���@��r+v�Q0��>^;˴�VbF��('����� �*O��i��j�Ӆ����^�S3&� ���{������.ی�� N;��NU%d0�Ce\r"�C�b��&t7N�7��� �ȪD�[%l�۪�$��'m?�A9tI�9>��NVL ��� 6v~M�����ъ�B���0����9$&=ώm��W�0���L���&��E���f�f��'+�9��hv��7,���M��6�D�&�^� �����8 D֮�����o��k^z��O��hP�8q�5d*��YVq3�{��������#LX4�?��jP=3�~�؅c�ݰ�̱�ұ��8̲��2�G�����j��έ�9��w7���U�X�w�85C��?!I&���o&����L���I#�^�eV�,�^t5�k� �xs˛\��U�8��."���{���ǵ�l4��ݼ�;��r"���G�/~���gJV�N糦��ZZ^k+NN�D��I$�=OE�z����|*�*{��%k���G��>�`9��b;�s���8,�qs��c��.b��q�%�>r��n�R�Ƨ�%�,�A��le#�8���}; 21�0�b�&�QX�f���q�00����$>�h�N�'�a3��A���/�r ��L5�8�GԲ'�����w;��c#�q1���h$*��V^�k��QĽ�b:i������� ����H F#�_���,��]g����Ը����`RUU���� ��"�qD���>-��ϤI�~��3�̴�����NZ[[555�eeek7�m����YF#[��Đ��R��i��L�H�r ��@��J-�Pŝ��_|�-��6y��ks�V�U~��6���w.����(��0A� 4��f��� /���C�xŊ�ٳ����z=6�����rg���mKo��o�/����a�g���?'9%9��P��斓��~���L{�� �H��{AW��B��$����v�1b�&Mb�ر��ر#�0`�`xMBp! )Z�Nmo�mZ�g�}�eذaWTVV ���'99��C5��&�&+5�bT>|8��PUUETT����&���t��~TE%��'������b�tEGG;RSS�S�N�v��ѯ��t����u1@�ޚ"f��͈���r'L�Ph��m��ƌ�74o��`�x�q�P���NRSS�X,�����l&&&��MFFA!-��`��ҷ�n��Yuu�����x<I�LB%����KԒ50�!�3�bz�����ʸKL���;---�l6[��`��������Ȏ;�����egg4��!D�T��jWujyZ��������K����%����p�^���X,6��sV=�ܖ����6�3�X ���4ҿ��A2�&����_k�;d�� �VfOIEND�B`� 0x0x
PHP 8.1.34
Preview: ExpressionParser.php Size: 36.78 KB
/home2/astrociv/public_html/wp-content/plugins/elementor/vendor_prefixed/twig/twig/twig/src/ExpressionParser.php
<?php

/*
 * This file is part of Twig.
 *
 * (c) Fabien Potencier
 * (c) Armin Ronacher
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace ElementorDeps\Twig;

use ElementorDeps\Twig\Error\SyntaxError;
use ElementorDeps\Twig\Node\Expression\AbstractExpression;
use ElementorDeps\Twig\Node\Expression\ArrayExpression;
use ElementorDeps\Twig\Node\Expression\ArrowFunctionExpression;
use ElementorDeps\Twig\Node\Expression\AssignNameExpression;
use ElementorDeps\Twig\Node\Expression\Binary\AbstractBinary;
use ElementorDeps\Twig\Node\Expression\Binary\ConcatBinary;
use ElementorDeps\Twig\Node\Expression\BlockReferenceExpression;
use ElementorDeps\Twig\Node\Expression\ConditionalExpression;
use ElementorDeps\Twig\Node\Expression\ConstantExpression;
use ElementorDeps\Twig\Node\Expression\GetAttrExpression;
use ElementorDeps\Twig\Node\Expression\MethodCallExpression;
use ElementorDeps\Twig\Node\Expression\NameExpression;
use ElementorDeps\Twig\Node\Expression\ParentExpression;
use ElementorDeps\Twig\Node\Expression\TestExpression;
use ElementorDeps\Twig\Node\Expression\Unary\AbstractUnary;
use ElementorDeps\Twig\Node\Expression\Unary\NegUnary;
use ElementorDeps\Twig\Node\Expression\Unary\NotUnary;
use ElementorDeps\Twig\Node\Expression\Unary\PosUnary;
use ElementorDeps\Twig\Node\Node;
/**
 * Parses expressions.
 *
 * This parser implements a "Precedence climbing" algorithm.
 *
 * @see https://www.engr.mun.ca/~theo/Misc/exp_parsing.htm
 * @see https://en.wikipedia.org/wiki/Operator-precedence_parser
 *
 * @author Fabien Potencier <fabien@symfony.com>
 */
class ExpressionParser
{
    public const OPERATOR_LEFT = 1;
    public const OPERATOR_RIGHT = 2;
    private $parser;
    private $env;
    /** @var array<string, array{precedence: int, class: class-string<AbstractUnary>}> */
    private $unaryOperators;
    /** @var array<string, array{precedence: int, class: class-string<AbstractBinary>, associativity: self::OPERATOR_*}> */
    private $binaryOperators;
    public function __construct(Parser $parser, Environment $env)
    {
        $this->parser = $parser;
        $this->env = $env;
        $this->unaryOperators = $env->getUnaryOperators();
        $this->binaryOperators = $env->getBinaryOperators();
    }
    public function parseExpression($precedence = 0, $allowArrow = \false)
    {
        if ($allowArrow && ($arrow = $this->parseArrow())) {
            return $arrow;
        }
        $expr = $this->getPrimary();
        $token = $this->parser->getCurrentToken();
        while ($this->isBinary($token) && $this->binaryOperators[$token->getValue()]['precedence'] >= $precedence) {
            $op = $this->binaryOperators[$token->getValue()];
            $this->parser->getStream()->next();
            if ('is not' === $token->getValue()) {
                $expr = $this->parseNotTestExpression($expr);
            } elseif ('is' === $token->getValue()) {
                $expr = $this->parseTestExpression($expr);
            } elseif (isset($op['callable'])) {
                $expr = $op['callable']($this->parser, $expr);
            } else {
                $expr1 = $this->parseExpression(self::OPERATOR_LEFT === $op['associativity'] ? $op['precedence'] + 1 : $op['precedence'], \true);
                $class = $op['class'];
                $expr = new $class($expr, $expr1, $token->getLine());
            }
            $token = $this->parser->getCurrentToken();
        }
        if (0 === $precedence) {
            return $this->parseConditionalExpression($expr);
        }
        return $expr;
    }
    /**
     * @return ArrowFunctionExpression|null
     */
    private function parseArrow()
    {
        $stream = $this->parser->getStream();
        // short array syntax (one argument, no parentheses)?
        if ($stream->look(1)->test(
            /* Token::ARROW_TYPE */
            12
        )) {
            $line = $stream->getCurrent()->getLine();
            $token = $stream->expect(
                /* Token::NAME_TYPE */
                5
            );
            $names = [new AssignNameExpression($token->getValue(), $token->getLine())];
            $stream->expect(
                /* Token::ARROW_TYPE */
                12
            );
            return new ArrowFunctionExpression($this->parseExpression(0), new Node($names), $line);
        }
        // first, determine if we are parsing an arrow function by finding => (long form)
        $i = 0;
        if (!$stream->look($i)->test(
            /* Token::PUNCTUATION_TYPE */
            9,
            '('
        )) {
            return null;
        }
        ++$i;
        while (\true) {
            // variable name
            ++$i;
            if (!$stream->look($i)->test(
                /* Token::PUNCTUATION_TYPE */
                9,
                ','
            )) {
                break;
            }
            ++$i;
        }
        if (!$stream->look($i)->test(
            /* Token::PUNCTUATION_TYPE */
            9,
            ')'
        )) {
            return null;
        }
        ++$i;
        if (!$stream->look($i)->test(
            /* Token::ARROW_TYPE */
            12
        )) {
            return null;
        }
        // yes, let's parse it properly
        $token = $stream->expect(
            /* Token::PUNCTUATION_TYPE */
            9,
            '('
        );
        $line = $token->getLine();
        $names = [];
        while (\true) {
            $token = $stream->expect(
                /* Token::NAME_TYPE */
                5
            );
            $names[] = new AssignNameExpression($token->getValue(), $token->getLine());
            if (!$stream->nextIf(
                /* Token::PUNCTUATION_TYPE */
                9,
                ','
            )) {
                break;
            }
        }
        $stream->expect(
            /* Token::PUNCTUATION_TYPE */
            9,
            ')'
        );
        $stream->expect(
            /* Token::ARROW_TYPE */
            12
        );
        return new ArrowFunctionExpression($this->parseExpression(0), new Node($names), $line);
    }
    private function getPrimary() : AbstractExpression
    {
        $token = $this->parser->getCurrentToken();
        if ($this->isUnary($token)) {
            $operator = $this->unaryOperators[$token->getValue()];
            $this->parser->getStream()->next();
            $expr = $this->parseExpression($operator['precedence']);
            $class = $operator['class'];
            return $this->parsePostfixExpression(new $class($expr, $token->getLine()));
        } elseif ($token->test(
            /* Token::PUNCTUATION_TYPE */
            9,
            '('
        )) {
            $this->parser->getStream()->next();
            $expr = $this->parseExpression();
            $this->parser->getStream()->expect(
                /* Token::PUNCTUATION_TYPE */
                9,
                ')',
                'An opened parenthesis is not properly closed'
            );
            return $this->parsePostfixExpression($expr);
        }
        return $this->parsePrimaryExpression();
    }
    private function parseConditionalExpression($expr) : AbstractExpression
    {
        while ($this->parser->getStream()->nextIf(
            /* Token::PUNCTUATION_TYPE */
            9,
            '?'
        )) {
            if (!$this->parser->getStream()->nextIf(
                /* Token::PUNCTUATION_TYPE */
                9,
                ':'
            )) {
                $expr2 = $this->parseExpression();
                if ($this->parser->getStream()->nextIf(
                    /* Token::PUNCTUATION_TYPE */
                    9,
                    ':'
                )) {
                    // Ternary operator (expr ? expr2 : expr3)
                    $expr3 = $this->parseExpression();
                } else {
                    // Ternary without else (expr ? expr2)
                    $expr3 = new ConstantExpression('', $this->parser->getCurrentToken()->getLine());
                }
            } else {
                // Ternary without then (expr ?: expr3)
                $expr2 = $expr;
                $expr3 = $this->parseExpression();
            }
            $expr = new ConditionalExpression($expr, $expr2, $expr3, $this->parser->getCurrentToken()->getLine());
        }
        return $expr;
    }
    private function isUnary(Token $token) : bool
    {
        return $token->test(
            /* Token::OPERATOR_TYPE */
            8
        ) && isset($this->unaryOperators[$token->getValue()]);
    }
    private function isBinary(Token $token) : bool
    {
        return $token->test(
            /* Token::OPERATOR_TYPE */
            8
        ) && isset($this->binaryOperators[$token->getValue()]);
    }
    public function parsePrimaryExpression()
    {
        $token = $this->parser->getCurrentToken();
        switch ($token->getType()) {
            case 5:
                $this->parser->getStream()->next();
                switch ($token->getValue()) {
                    case 'true':
                    case 'TRUE':
                        $node = new ConstantExpression(\true, $token->getLine());
                        break;
                    case 'false':
                    case 'FALSE':
                        $node = new ConstantExpression(\false, $token->getLine());
                        break;
                    case 'none':
                    case 'NONE':
                    case 'null':
                    case 'NULL':
                        $node = new ConstantExpression(null, $token->getLine());
                        break;
                    default:
                        if ('(' === $this->parser->getCurrentToken()->getValue()) {
                            $node = $this->getFunctionNode($token->getValue(), $token->getLine());
                        } else {
                            $node = new NameExpression($token->getValue(), $token->getLine());
                        }
                }
                break;
            case 6:
                $this->parser->getStream()->next();
                $node = new ConstantExpression($token->getValue(), $token->getLine());
                break;
            case 7:
            case 10:
                $node = $this->parseStringExpression();
                break;
            case 8:
                if (\preg_match(Lexer::REGEX_NAME, $token->getValue(), $matches) && $matches[0] == $token->getValue()) {
                    // in this context, string operators are variable names
                    $this->parser->getStream()->next();
                    $node = new NameExpression($token->getValue(), $token->getLine());
                    break;
                }
                if (isset($this->unaryOperators[$token->getValue()])) {
                    $class = $this->unaryOperators[$token->getValue()]['class'];
                    if (!\in_array($class, [NegUnary::class, PosUnary::class])) {
                        throw new SyntaxError(\sprintf('Unexpected unary operator "%s".', $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext());
                    }
                    $this->parser->getStream()->next();
                    $expr = $this->parsePrimaryExpression();
                    $node = new $class($expr, $token->getLine());
                    break;
                }
            // no break
            default:
                if ($token->test(
                    /* Token::PUNCTUATION_TYPE */
                    9,
                    '['
                )) {
                    $node = $this->parseSequenceExpression();
                } elseif ($token->test(
                    /* Token::PUNCTUATION_TYPE */
                    9,
                    '{'
                )) {
                    $node = $this->parseMappingExpression();
                } elseif ($token->test(
                    /* Token::OPERATOR_TYPE */
                    8,
                    '='
                ) && ('==' === $this->parser->getStream()->look(-1)->getValue() || '!=' === $this->parser->getStream()->look(-1)->getValue())) {
                    throw new SyntaxError(\sprintf('Unexpected operator of value "%s". Did you try to use "===" or "!==" for strict comparison? Use "is same as(value)" instead.', $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext());
                } else {
                    throw new SyntaxError(\sprintf('Unexpected token "%s" of value "%s".', Token::typeToEnglish($token->getType()), $token->getValue()), $token->getLine(), $this->parser->getStream()->getSourceContext());
                }
        }
        return $this->parsePostfixExpression($node);
    }
    public function parseStringExpression()
    {
        $stream = $this->parser->getStream();
        $nodes = [];
        // a string cannot be followed by another string in a single expression
        $nextCanBeString = \true;
        while (\true) {
            if ($nextCanBeString && ($token = $stream->nextIf(
                /* Token::STRING_TYPE */
                7
            ))) {
                $nodes[] = new ConstantExpression($token->getValue(), $token->getLine());
                $nextCanBeString = \false;
            } elseif ($stream->nextIf(
                /* Token::INTERPOLATION_START_TYPE */
                10
            )) {
                $nodes[] = $this->parseExpression();
                $stream->expect(
                    /* Token::INTERPOLATION_END_TYPE */
                    11
                );
                $nextCanBeString = \true;
            } else {
                break;
            }
        }
        $expr = \array_shift($nodes);
        foreach ($nodes as $node) {
            $expr = new ConcatBinary($expr, $node, $node->getTemplateLine());
        }
        return $expr;
    }
    /**
     * @deprecated since 3.11, use parseSequenceExpression() instead
     */
    public function parseArrayExpression()
    {
        trigger_deprecation('twig/twig', '3.11', 'Calling "%s()" is deprecated, use "parseSequenceExpression()" instead.', __METHOD__);
        return $this->parseSequenceExpression();
    }
    public function parseSequenceExpression()
    {
        $stream = $this->parser->getStream();
        $stream->expect(
            /* Token::PUNCTUATION_TYPE */
            9,
            '[',
            'A sequence element was expected'
        );
        $node = new ArrayExpression([], $stream->getCurrent()->getLine());
        $first = \true;
        while (!$stream->test(
            /* Token::PUNCTUATION_TYPE */
            9,
            ']'
        )) {
            if (!$first) {
                $stream->expect(
                    /* Token::PUNCTUATION_TYPE */
                    9,
                    ',',
                    'A sequence element must be followed by a comma'
                );
                // trailing ,?
                if ($stream->test(
                    /* Token::PUNCTUATION_TYPE */
                    9,
                    ']'
                )) {
                    break;
                }
            }
            $first = \false;
            if ($stream->test(
                /* Token::SPREAD_TYPE */
                13
            )) {
                $stream->next();
                $expr = $this->parseExpression();
                $expr->setAttribute('spread', \true);
                $node->addElement($expr);
            } else {
                $node->addElement($this->parseExpression());
            }
        }
        $stream->expect(
            /* Token::PUNCTUATION_TYPE */
            9,
            ']',
            'An opened sequence is not properly closed'
        );
        return $node;
    }
    /**
     * @deprecated since 3.11, use parseMappingExpression() instead
     */
    public function parseHashExpression()
    {
        trigger_deprecation('twig/twig', '3.11', 'Calling "%s()" is deprecated, use "parseMappingExpression()" instead.', __METHOD__);
        return $this->parseMappingExpression();
    }
    public function parseMappingExpression()
    {
        $stream = $this->parser->getStream();
        $stream->expect(
            /* Token::PUNCTUATION_TYPE */
            9,
            '{',
            'A mapping element was expected'
        );
        $node = new ArrayExpression([], $stream->getCurrent()->getLine());
        $first = \true;
        while (!$stream->test(
            /* Token::PUNCTUATION_TYPE */
            9,
            '}'
        )) {
            if (!$first) {
                $stream->expect(
                    /* Token::PUNCTUATION_TYPE */
                    9,
                    ',',
                    'A mapping value must be followed by a comma'
                );
                // trailing ,?
                if ($stream->test(
                    /* Token::PUNCTUATION_TYPE */
                    9,
                    '}'
                )) {
                    break;
                }
            }
            $first = \false;
            if ($stream->test(
                /* Token::SPREAD_TYPE */
                13
            )) {
                $stream->next();
                $value = $this->parseExpression();
                $value->setAttribute('spread', \true);
                $node->addElement($value);
                continue;
            }
            // a mapping key can be:
            //
            //  * a number -- 12
            //  * a string -- 'a'
            //  * a name, which is equivalent to a string -- a
            //  * an expression, which must be enclosed in parentheses -- (1 + 2)
            if ($token = $stream->nextIf(
                /* Token::NAME_TYPE */
                5
            )) {
                $key = new ConstantExpression($token->getValue(), $token->getLine());
                // {a} is a shortcut for {a:a}
                if ($stream->test(Token::PUNCTUATION_TYPE, [',', '}'])) {
                    $value = new NameExpression($key->getAttribute('value'), $key->getTemplateLine());
                    $node->addElement($value, $key);
                    continue;
                }
            } elseif (($token = $stream->nextIf(
                /* Token::STRING_TYPE */
                7
            )) || ($token = $stream->nextIf(
                /* Token::NUMBER_TYPE */
                6
            ))) {
                $key = new ConstantExpression($token->getValue(), $token->getLine());
            } elseif ($stream->test(
                /* Token::PUNCTUATION_TYPE */
                9,
                '('
            )) {
                $key = $this->parseExpression();
            } else {
                $current = $stream->getCurrent();
                throw new SyntaxError(\sprintf('A mapping key must be a quoted string, a number, a name, or an expression enclosed in parentheses (unexpected token "%s" of value "%s".', Token::typeToEnglish($current->getType()), $current->getValue()), $current->getLine(), $stream->getSourceContext());
            }
            $stream->expect(
                /* Token::PUNCTUATION_TYPE */
                9,
                ':',
                'A mapping key must be followed by a colon (:)'
            );
            $value = $this->parseExpression();
            $node->addElement($value, $key);
        }
        $stream->expect(
            /* Token::PUNCTUATION_TYPE */
            9,
            '}',
            'An opened mapping is not properly closed'
        );
        return $node;
    }
    public function parsePostfixExpression($node)
    {
        while (\true) {
            $token = $this->parser->getCurrentToken();
            if (9 == $token->getType()) {
                if ('.' == $token->getValue() || '[' == $token->getValue()) {
                    $node = $this->parseSubscriptExpression($node);
                } elseif ('|' == $token->getValue()) {
                    $node = $this->parseFilterExpression($node);
                } else {
                    break;
                }
            } else {
                break;
            }
        }
        return $node;
    }
    public function getFunctionNode($name, $line)
    {
        switch ($name) {
            case 'parent':
                $this->parseArguments();
                if (!\count($this->parser->getBlockStack())) {
                    throw new SyntaxError('Calling "parent" outside a block is forbidden.', $line, $this->parser->getStream()->getSourceContext());
                }
                if (!$this->parser->getParent() && !$this->parser->hasTraits()) {
                    throw new SyntaxError('Calling "parent" on a template that does not extend nor "use" another template is forbidden.', $line, $this->parser->getStream()->getSourceContext());
                }
                return new ParentExpression($this->parser->peekBlockStack(), $line);
            case 'block':
                $args = $this->parseArguments();
                if (\count($args) < 1) {
                    throw new SyntaxError('The "block" function takes one argument (the block name).', $line, $this->parser->getStream()->getSourceContext());
                }
                return new BlockReferenceExpression($args->getNode('0'), \count($args) > 1 ? $args->getNode('1') : null, $line);
            case 'attribute':
                $args = $this->parseArguments();
                if (\count($args) < 2) {
                    throw new SyntaxError('The "attribute" function takes at least two arguments (the variable and the attributes).', $line, $this->parser->getStream()->getSourceContext());
                }
                return new GetAttrExpression($args->getNode('0'), $args->getNode('1'), \count($args) > 2 ? $args->getNode('2') : null, Template::ANY_CALL, $line);
            default:
                if (null !== ($alias = $this->parser->getImportedSymbol('function', $name))) {
                    $arguments = new ArrayExpression([], $line);
                    foreach ($this->parseArguments() as $n) {
                        $arguments->addElement($n);
                    }
                    $node = new MethodCallExpression($alias['node'], $alias['name'], $arguments, $line);
                    $node->setAttribute('safe', \true);
                    return $node;
                }
                $args = $this->parseArguments(\true);
                $class = $this->getFunctionNodeClass($name, $line);
                return new $class($name, $args, $line);
        }
    }
    public function parseSubscriptExpression($node)
    {
        $stream = $this->parser->getStream();
        $token = $stream->next();
        $lineno = $token->getLine();
        $arguments = new ArrayExpression([], $lineno);
        $type = Template::ANY_CALL;
        if ('.' == $token->getValue()) {
            $token = $stream->next();
            if (5 == $token->getType() || 6 == $token->getType() || 8 == $token->getType() && \preg_match(Lexer::REGEX_NAME, $token->getValue())) {
                $arg = new ConstantExpression($token->getValue(), $lineno);
                if ($stream->test(
                    /* Token::PUNCTUATION_TYPE */
                    9,
                    '('
                )) {
                    $type = Template::METHOD_CALL;
                    foreach ($this->parseArguments() as $n) {
                        $arguments->addElement($n);
                    }
                }
            } else {
                throw new SyntaxError(\sprintf('Expected name or number, got value "%s" of type %s.', $token->getValue(), Token::typeToEnglish($token->getType())), $lineno, $stream->getSourceContext());
            }
            if ($node instanceof NameExpression && null !== $this->parser->getImportedSymbol('template', $node->getAttribute('name'))) {
                $name = $arg->getAttribute('value');
                $node = new MethodCallExpression($node, 'macro_' . $name, $arguments, $lineno);
                $node->setAttribute('safe', \true);
                return $node;
            }
        } else {
            $type = Template::ARRAY_CALL;
            // slice?
            $slice = \false;
            if ($stream->test(
                /* Token::PUNCTUATION_TYPE */
                9,
                ':'
            )) {
                $slice = \true;
                $arg = new ConstantExpression(0, $token->getLine());
            } else {
                $arg = $this->parseExpression();
            }
            if ($stream->nextIf(
                /* Token::PUNCTUATION_TYPE */
                9,
                ':'
            )) {
                $slice = \true;
            }
            if ($slice) {
                if ($stream->test(
                    /* Token::PUNCTUATION_TYPE */
                    9,
                    ']'
                )) {
                    $length = new ConstantExpression(null, $token->getLine());
                } else {
                    $length = $this->parseExpression();
                }
                $class = $this->getFilterNodeClass('slice', $token->getLine());
                $arguments = new Node([$arg, $length]);
                $filter = new $class($node, new ConstantExpression('slice', $token->getLine()), $arguments, $token->getLine());
                $stream->expect(
                    /* Token::PUNCTUATION_TYPE */
                    9,
                    ']'
                );
                return $filter;
            }
            $stream->expect(
                /* Token::PUNCTUATION_TYPE */
                9,
                ']'
            );
        }
        return new GetAttrExpression($node, $arg, $arguments, $type, $lineno);
    }
    public function parseFilterExpression($node)
    {
        $this->parser->getStream()->next();
        return $this->parseFilterExpressionRaw($node);
    }
    public function parseFilterExpressionRaw($node, $tag = null)
    {
        while (\true) {
            $token = $this->parser->getStream()->expect(
                /* Token::NAME_TYPE */
                5
            );
            $name = new ConstantExpression($token->getValue(), $token->getLine());
            if (!$this->parser->getStream()->test(
                /* Token::PUNCTUATION_TYPE */
                9,
                '('
            )) {
                $arguments = new Node();
            } else {
                $arguments = $this->parseArguments(\true, \false, \true);
            }
            $class = $this->getFilterNodeClass($name->getAttribute('value'), $token->getLine());
            $node = new $class($node, $name, $arguments, $token->getLine(), $tag);
            if (!$this->parser->getStream()->test(
                /* Token::PUNCTUATION_TYPE */
                9,
                '|'
            )) {
                break;
            }
            $this->parser->getStream()->next();
        }
        return $node;
    }
    /**
     * Parses arguments.
     *
     * @param bool $namedArguments Whether to allow named arguments or not
     * @param bool $definition     Whether we are parsing arguments for a function definition
     *
     * @return Node
     *
     * @throws SyntaxError
     */
    public function parseArguments($namedArguments = \false, $definition = \false, $allowArrow = \false)
    {
        $args = [];
        $stream = $this->parser->getStream();
        $stream->expect(
            /* Token::PUNCTUATION_TYPE */
            9,
            '(',
            'A list of arguments must begin with an opening parenthesis'
        );
        while (!$stream->test(
            /* Token::PUNCTUATION_TYPE */
            9,
            ')'
        )) {
            if (!empty($args)) {
                $stream->expect(
                    /* Token::PUNCTUATION_TYPE */
                    9,
                    ',',
                    'Arguments must be separated by a comma'
                );
                // if the comma above was a trailing comma, early exit the argument parse loop
                if ($stream->test(
                    /* Token::PUNCTUATION_TYPE */
                    9,
                    ')'
                )) {
                    break;
                }
            }
            if ($definition) {
                $token = $stream->expect(
                    /* Token::NAME_TYPE */
                    5,
                    null,
                    'An argument must be a name'
                );
                $value = new NameExpression($token->getValue(), $this->parser->getCurrentToken()->getLine());
            } else {
                $value = $this->parseExpression(0, $allowArrow);
            }
            $name = null;
            if ($namedArguments && ($token = $stream->nextIf(
                /* Token::OPERATOR_TYPE */
                8,
                '='
            ))) {
                if (!$value instanceof NameExpression) {
                    throw new SyntaxError(\sprintf('A parameter name must be a string, "%s" given.', \get_class($value)), $token->getLine(), $stream->getSourceContext());
                }
                $name = $value->getAttribute('name');
                if ($definition) {
                    $value = $this->parsePrimaryExpression();
                    if (!$this->checkConstantExpression($value)) {
                        throw new SyntaxError('A default value for an argument must be a constant (a boolean, a string, a number, a sequence, or a mapping).', $token->getLine(), $stream->getSourceContext());
                    }
                } else {
                    $value = $this->parseExpression(0, $allowArrow);
                }
            }
            if ($definition) {
                if (null === $name) {
                    $name = $value->getAttribute('name');
                    $value = new ConstantExpression(null, $this->parser->getCurrentToken()->getLine());
                }
                $args[$name] = $value;
            } else {
                if (null === $name) {
                    $args[] = $value;
                } else {
                    $args[$name] = $value;
                }
            }
        }
        $stream->expect(
            /* Token::PUNCTUATION_TYPE */
            9,
            ')',
            'A list of arguments must be closed by a parenthesis'
        );
        return new Node($args);
    }
    public function parseAssignmentExpression()
    {
        $stream = $this->parser->getStream();
        $targets = [];
        while (\true) {
            $token = $this->parser->getCurrentToken();
            if ($stream->test(
                /* Token::OPERATOR_TYPE */
                8
            ) && \preg_match(Lexer::REGEX_NAME, $token->getValue())) {
                // in this context, string operators are variable names
                $this->parser->getStream()->next();
            } else {
                $stream->expect(
                    /* Token::NAME_TYPE */
                    5,
                    null,
                    'Only variables can be assigned to'
                );
            }
            $value = $token->getValue();
            if (\in_array(\strtr($value, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), ['true', 'false', 'none', 'null'])) {
                throw new SyntaxError(\sprintf('You cannot assign a value to "%s".', $value), $token->getLine(), $stream->getSourceContext());
            }
            $targets[] = new AssignNameExpression($value, $token->getLine());
            if (!$stream->nextIf(
                /* Token::PUNCTUATION_TYPE */
                9,
                ','
            )) {
                break;
            }
        }
        return new Node($targets);
    }
    public function parseMultitargetExpression()
    {
        $targets = [];
        while (\true) {
            $targets[] = $this->parseExpression();
            if (!$this->parser->getStream()->nextIf(
                /* Token::PUNCTUATION_TYPE */
                9,
                ','
            )) {
                break;
            }
        }
        return new Node($targets);
    }
    private function parseNotTestExpression(Node $node) : NotUnary
    {
        return new NotUnary($this->parseTestExpression($node), $this->parser->getCurrentToken()->getLine());
    }
    private function parseTestExpression(Node $node) : TestExpression
    {
        $stream = $this->parser->getStream();
        [$name, $test] = $this->getTest($node->getTemplateLine());
        $class = $this->getTestNodeClass($test);
        $arguments = null;
        if ($stream->test(
            /* Token::PUNCTUATION_TYPE */
            9,
            '('
        )) {
            $arguments = $this->parseArguments(\true);
        } elseif ($test->hasOneMandatoryArgument()) {
            $arguments = new Node([0 => $this->parsePrimaryExpression()]);
        }
        if ('defined' === $name && $node instanceof NameExpression && null !== ($alias = $this->parser->getImportedSymbol('function', $node->getAttribute('name')))) {
            $node = new MethodCallExpression($alias['node'], $alias['name'], new ArrayExpression([], $node->getTemplateLine()), $node->getTemplateLine());
            $node->setAttribute('safe', \true);
        }
        return new $class($node, $name, $arguments, $this->parser->getCurrentToken()->getLine());
    }
    private function getTest(int $line) : array
    {
        $stream = $this->parser->getStream();
        $name = $stream->expect(
            /* Token::NAME_TYPE */
            5
        )->getValue();
        if ($test = $this->env->getTest($name)) {
            return [$name, $test];
        }
        if ($stream->test(
            /* Token::NAME_TYPE */
            5
        )) {
            // try 2-words tests
            $name = $name . ' ' . $this->parser->getCurrentToken()->getValue();
            if ($test = $this->env->getTest($name)) {
                $stream->next();
                return [$name, $test];
            }
        }
        $e = new SyntaxError(\sprintf('Unknown "%s" test.', $name), $line, $stream->getSourceContext());
        $e->addSuggestions($name, \array_keys($this->env->getTests()));
        throw $e;
    }
    private function getTestNodeClass(TwigTest $test) : string
    {
        if ($test->isDeprecated()) {
            $stream = $this->parser->getStream();
            $message = \sprintf('Twig Test "%s" is deprecated', $test->getName());
            if ($test->getAlternative()) {
                $message .= \sprintf('. Use "%s" instead', $test->getAlternative());
            }
            $src = $stream->getSourceContext();
            $message .= \sprintf(' in %s at line %d.', $src->getPath() ?: $src->getName(), $stream->getCurrent()->getLine());
            trigger_deprecation($test->getDeprecatingPackage(), $test->getDeprecatedVersion(), $message);
        }
        return $test->getNodeClass();
    }
    private function getFunctionNodeClass(string $name, int $line) : string
    {
        if (!($function = $this->env->getFunction($name))) {
            $e = new SyntaxError(\sprintf('Unknown "%s" function.', $name), $line, $this->parser->getStream()->getSourceContext());
            $e->addSuggestions($name, \array_keys($this->env->getFunctions()));
            throw $e;
        }
        if ($function->isDeprecated()) {
            $message = \sprintf('Twig Function "%s" is deprecated', $function->getName());
            if ($function->getAlternative()) {
                $message .= \sprintf('. Use "%s" instead', $function->getAlternative());
            }
            $src = $this->parser->getStream()->getSourceContext();
            $message .= \sprintf(' in %s at line %d.', $src->getPath() ?: $src->getName(), $line);
            trigger_deprecation($function->getDeprecatingPackage(), $function->getDeprecatedVersion(), $message);
        }
        return $function->getNodeClass();
    }
    private function getFilterNodeClass(string $name, int $line) : string
    {
        if (!($filter = $this->env->getFilter($name))) {
            $e = new SyntaxError(\sprintf('Unknown "%s" filter.', $name), $line, $this->parser->getStream()->getSourceContext());
            $e->addSuggestions($name, \array_keys($this->env->getFilters()));
            throw $e;
        }
        if ($filter->isDeprecated()) {
            $message = \sprintf('Twig Filter "%s" is deprecated', $filter->getName());
            if ($filter->getAlternative()) {
                $message .= \sprintf('. Use "%s" instead', $filter->getAlternative());
            }
            $src = $this->parser->getStream()->getSourceContext();
            $message .= \sprintf(' in %s at line %d.', $src->getPath() ?: $src->getName(), $line);
            trigger_deprecation($filter->getDeprecatingPackage(), $filter->getDeprecatedVersion(), $message);
        }
        return $filter->getNodeClass();
    }
    // checks that the node only contains "constant" elements
    private function checkConstantExpression(Node $node) : bool
    {
        if (!($node instanceof ConstantExpression || $node instanceof ArrayExpression || $node instanceof NegUnary || $node instanceof PosUnary)) {
            return \false;
        }
        foreach ($node as $n) {
            if (!$this->checkConstantExpression($n)) {
                return \false;
            }
        }
        return \true;
    }
}

Directory Contents

Dirs: 15 × Files: 17
Name Size Perms Modified Actions
Attribute DIR
- drwxr-xr-x 2026-09-08 12:13:54
Edit Download
Cache DIR
- drwxr-xr-x 2026-09-08 12:13:54
Edit Download
Error DIR
- drwxr-xr-x 2026-09-08 12:13:54
Edit Download
Extension DIR
- drwxr-xr-x 2026-09-08 12:13:54
Edit Download
Loader DIR
- drwxr-xr-x 2026-09-08 12:13:54
Edit Download
Node DIR
- drwxr-xr-x 2026-09-08 12:13:54
Edit Download
- drwxr-xr-x 2026-09-08 12:13:54
Edit Download
Profiler DIR
- drwxr-xr-x 2026-09-08 12:13:54
Edit Download
Resources DIR
- drwxr-xr-x 2026-09-08 12:13:54
Edit Download
Runtime DIR
- drwxr-xr-x 2026-09-08 12:13:54
Edit Download
- drwxr-xr-x 2026-09-08 12:13:54
Edit Download
Sandbox DIR
- drwxr-xr-x 2026-09-08 12:13:54
Edit Download
Test DIR
- drwxr-xr-x 2026-09-08 12:13:54
Edit Download
- drwxr-xr-x 2026-09-08 12:13:54
Edit Download
Util DIR
- drwxr-xr-x 2026-09-08 12:13:54
Edit Download
6.21 KB lrwxr-xr-x 2026-09-08 12:13:54
Edit Download
25.85 KB lrwxr-xr-x 2026-09-08 12:13:54
Edit Download
36.78 KB lrwxr-xr-x 2026-09-08 12:13:54
Edit Download
13.28 KB lrwxr-xr-x 2026-09-08 12:13:54
Edit Download
1.43 KB lrwxr-xr-x 2026-09-08 12:13:54
Edit Download
19.08 KB lrwxr-xr-x 2026-09-08 12:13:54
Edit Download
949 B lrwxr-xr-x 2026-09-08 12:13:54
Edit Download
1.81 KB lrwxr-xr-x 2026-09-08 12:13:54
Edit Download
11.28 KB lrwxr-xr-x 2026-09-08 12:13:54
Edit Download
1.01 KB lrwxr-xr-x 2026-09-08 12:13:54
Edit Download
14.89 KB lrwxr-xr-x 2026-09-08 12:13:54
Edit Download
2.17 KB lrwxr-xr-x 2026-09-08 12:13:54
Edit Download
5.35 KB lrwxr-xr-x 2026-09-08 12:13:54
Edit Download
3.33 KB lrwxr-xr-x 2026-09-08 12:13:54
Edit Download
3.29 KB lrwxr-xr-x 2026-09-08 12:13:54
Edit Download
3.05 KB lrwxr-xr-x 2026-09-08 12:13:54
Edit Download
2.40 KB lrwxr-xr-x 2026-09-08 12:13:54
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).
© 2026 0xNothings — Secure File Manager. All rights reserved. Built with ❤️ & Tailwind x Dark UI