You are here

public function Twig_ExpressionParser::parseFilterExpressionRaw in Translation template extractor 6.3

Same name and namespace in other branches
  1. 7.3 vendor/Twig/ExpressionParser.php \Twig_ExpressionParser::parseFilterExpressionRaw()
1 call to Twig_ExpressionParser::parseFilterExpressionRaw()
Twig_ExpressionParser::parseFilterExpression in vendor/Twig/ExpressionParser.php

File

vendor/Twig/ExpressionParser.php, line 425

Class

Twig_ExpressionParser
Parses expressions.

Code

public function parseFilterExpressionRaw($node, $tag = null) {
  while (true) {
    $token = $this->parser
      ->getStream()
      ->expect(Twig_Token::NAME_TYPE);
    $name = new Twig_Node_Expression_Constant($token
      ->getValue(), $token
      ->getLine());
    if (!$this->parser
      ->getStream()
      ->test(Twig_Token::PUNCTUATION_TYPE, '(')) {
      $arguments = new Twig_Node();
    }
    else {
      $arguments = $this
        ->parseArguments(true);
    }
    $class = $this
      ->getFilterNodeClass($name
      ->getAttribute('value'), $token
      ->getLine());
    $node = new $class($node, $name, $arguments, $token
      ->getLine(), $tag);
    if (!$this->parser
      ->getStream()
      ->test(Twig_Token::PUNCTUATION_TYPE, '|')) {
      break;
    }
    $this->parser
      ->getStream()
      ->next();
  }
  return $node;
}