You are here

public function Twig_Extension_Core::getOperators in Translation template extractor 6.3

Same name and namespace in other branches
  1. 7.3 vendor/Twig/Extension/Core.php \Twig_Extension_Core::getOperators()

Returns a list of operators to add to the existing list.

Return value

array An array of operators

Overrides Twig_Extension::getOperators

File

vendor/Twig/Extension/Core.php, line 253

Class

Twig_Extension_Core

Code

public function getOperators() {
  return array(
    array(
      'not' => array(
        'precedence' => 50,
        'class' => 'Twig_Node_Expression_Unary_Not',
      ),
      '-' => array(
        'precedence' => 500,
        'class' => 'Twig_Node_Expression_Unary_Neg',
      ),
      '+' => array(
        'precedence' => 500,
        'class' => 'Twig_Node_Expression_Unary_Pos',
      ),
    ),
    array(
      'or' => array(
        'precedence' => 10,
        'class' => 'Twig_Node_Expression_Binary_Or',
        'associativity' => Twig_ExpressionParser::OPERATOR_LEFT,
      ),
      'and' => array(
        'precedence' => 15,
        'class' => 'Twig_Node_Expression_Binary_And',
        'associativity' => Twig_ExpressionParser::OPERATOR_LEFT,
      ),
      'b-or' => array(
        'precedence' => 16,
        'class' => 'Twig_Node_Expression_Binary_BitwiseOr',
        'associativity' => Twig_ExpressionParser::OPERATOR_LEFT,
      ),
      'b-xor' => array(
        'precedence' => 17,
        'class' => 'Twig_Node_Expression_Binary_BitwiseXor',
        'associativity' => Twig_ExpressionParser::OPERATOR_LEFT,
      ),
      'b-and' => array(
        'precedence' => 18,
        'class' => 'Twig_Node_Expression_Binary_BitwiseAnd',
        'associativity' => Twig_ExpressionParser::OPERATOR_LEFT,
      ),
      '==' => array(
        'precedence' => 20,
        'class' => 'Twig_Node_Expression_Binary_Equal',
        'associativity' => Twig_ExpressionParser::OPERATOR_LEFT,
      ),
      '!=' => array(
        'precedence' => 20,
        'class' => 'Twig_Node_Expression_Binary_NotEqual',
        'associativity' => Twig_ExpressionParser::OPERATOR_LEFT,
      ),
      '<' => array(
        'precedence' => 20,
        'class' => 'Twig_Node_Expression_Binary_Less',
        'associativity' => Twig_ExpressionParser::OPERATOR_LEFT,
      ),
      '>' => array(
        'precedence' => 20,
        'class' => 'Twig_Node_Expression_Binary_Greater',
        'associativity' => Twig_ExpressionParser::OPERATOR_LEFT,
      ),
      '>=' => array(
        'precedence' => 20,
        'class' => 'Twig_Node_Expression_Binary_GreaterEqual',
        'associativity' => Twig_ExpressionParser::OPERATOR_LEFT,
      ),
      '<=' => array(
        'precedence' => 20,
        'class' => 'Twig_Node_Expression_Binary_LessEqual',
        'associativity' => Twig_ExpressionParser::OPERATOR_LEFT,
      ),
      'not in' => array(
        'precedence' => 20,
        'class' => 'Twig_Node_Expression_Binary_NotIn',
        'associativity' => Twig_ExpressionParser::OPERATOR_LEFT,
      ),
      'in' => array(
        'precedence' => 20,
        'class' => 'Twig_Node_Expression_Binary_In',
        'associativity' => Twig_ExpressionParser::OPERATOR_LEFT,
      ),
      'matches' => array(
        'precedence' => 20,
        'class' => 'Twig_Node_Expression_Binary_Matches',
        'associativity' => Twig_ExpressionParser::OPERATOR_LEFT,
      ),
      'starts with' => array(
        'precedence' => 20,
        'class' => 'Twig_Node_Expression_Binary_StartsWith',
        'associativity' => Twig_ExpressionParser::OPERATOR_LEFT,
      ),
      'ends with' => array(
        'precedence' => 20,
        'class' => 'Twig_Node_Expression_Binary_EndsWith',
        'associativity' => Twig_ExpressionParser::OPERATOR_LEFT,
      ),
      '..' => array(
        'precedence' => 25,
        'class' => 'Twig_Node_Expression_Binary_Range',
        'associativity' => Twig_ExpressionParser::OPERATOR_LEFT,
      ),
      '+' => array(
        'precedence' => 30,
        'class' => 'Twig_Node_Expression_Binary_Add',
        'associativity' => Twig_ExpressionParser::OPERATOR_LEFT,
      ),
      '-' => array(
        'precedence' => 30,
        'class' => 'Twig_Node_Expression_Binary_Sub',
        'associativity' => Twig_ExpressionParser::OPERATOR_LEFT,
      ),
      '~' => array(
        'precedence' => 40,
        'class' => 'Twig_Node_Expression_Binary_Concat',
        'associativity' => Twig_ExpressionParser::OPERATOR_LEFT,
      ),
      '*' => array(
        'precedence' => 60,
        'class' => 'Twig_Node_Expression_Binary_Mul',
        'associativity' => Twig_ExpressionParser::OPERATOR_LEFT,
      ),
      '/' => array(
        'precedence' => 60,
        'class' => 'Twig_Node_Expression_Binary_Div',
        'associativity' => Twig_ExpressionParser::OPERATOR_LEFT,
      ),
      '//' => array(
        'precedence' => 60,
        'class' => 'Twig_Node_Expression_Binary_FloorDiv',
        'associativity' => Twig_ExpressionParser::OPERATOR_LEFT,
      ),
      '%' => array(
        'precedence' => 60,
        'class' => 'Twig_Node_Expression_Binary_Mod',
        'associativity' => Twig_ExpressionParser::OPERATOR_LEFT,
      ),
      'is' => array(
        'precedence' => 100,
        'callable' => array(
          $this,
          'parseTestExpression',
        ),
        'associativity' => Twig_ExpressionParser::OPERATOR_LEFT,
      ),
      'is not' => array(
        'precedence' => 100,
        'callable' => array(
          $this,
          'parseNotTestExpression',
        ),
        'associativity' => Twig_ExpressionParser::OPERATOR_LEFT,
      ),
      '**' => array(
        'precedence' => 200,
        'class' => 'Twig_Node_Expression_Binary_Power',
        'associativity' => Twig_ExpressionParser::OPERATOR_RIGHT,
      ),
    ),
  );
}