protected function getPrimary() {
$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(Twig_Token::PUNCTUATION_TYPE, '(')) {
$this->parser
->getStream()
->next();
$expr = $this
->parseExpression();
$this->parser
->getStream()
->expect(Twig_Token::PUNCTUATION_TYPE, ')', 'An opened parenthesis is not properly closed');
return $this
->parsePostfixExpression($expr);
}
return $this
->parsePrimaryExpression();
}