Flow\Parser::parseSet PHP Method

parseSet() protected method

protected parseSet ( $token )
    protected function parseSet($token)
    {
        $attrs = array();
        $name = $this->parseName()->getValue();
        while (!$this->stream->test(Token::OPERATOR, '=') && !$this->stream->test(Token::BLOCK_END)) {
            if ($this->stream->consume(Token::OPERATOR, '.')) {
                $attrs[] = $this->parseName()->getValue();
            } else {
                $this->stream->expect(Token::OPERATOR, '[');
                $attrs[] = $this->parseExpression();
                $this->stream->expect(Token::OPERATOR, ']');
            }
        }
        if ($this->stream->consume(Token::OPERATOR, '=')) {
            $value = $this->parseExpression();
            $node = $this->parseIfModifier($token, new Node\SetNode($name, $attrs, $value, $token->getLine()));
            $this->stream->expect(Token::BLOCK_END);
        } else {
            $this->stream->expect(Token::BLOCK_END);
            $body = $this->subparse('endset');
            if ($this->stream->next()->getValue() != 'endset') {
                throw new SyntaxError('malformed set statement', $token);
            }
            $this->stream->expect(Token::BLOCK_END);
            $node = new Node\SetNode($name, $attrs, $body, $token->getLine());
        }
        return $node;
    }