public function compile(Compiler $compiler)
 {
     $arguments = array();
     foreach ($this->nodes['arguments']->nodes as $node) {
         $arguments[] = $compiler->subcompile($node);
     }
     $function = $compiler->getFunction($this->attributes['name']);
     $compiler->raw(call_user_func_array($function['compiler'], $arguments));
 }
Example #2
0
 protected function compileArguments(Compiler $compiler, $withKeys = true)
 {
     $first = true;
     foreach ($this->getKeyValuePairs() as $pair) {
         if (!$first) {
             $compiler->raw(', ');
         }
         $first = false;
         if ($withKeys) {
             $compiler->compile($pair['key'])->raw(' => ');
         }
         $compiler->compile($pair['value']);
     }
 }
 public function compile(Compiler $compiler)
 {
     switch ($this->attributes['type']) {
         case self::PROPERTY_CALL:
             $compiler->compile($this->nodes['node'])->raw('->')->raw($this->nodes['attribute']->attributes['value']);
             break;
         case self::METHOD_CALL:
             $compiler->compile($this->nodes['node'])->raw('->')->raw($this->nodes['attribute']->attributes['value'])->raw('(')->compile($this->nodes['arguments'])->raw(')');
             break;
         case self::ARRAY_CALL:
             $compiler->compile($this->nodes['node'])->raw('[')->compile($this->nodes['attribute'])->raw(']');
             break;
     }
 }
Example #4
0
 public function compile(Compiler $compiler)
 {
     $operator = $this->attributes['operator'];
     if ('matches' == $operator) {
         $compiler->raw('preg_match(')->compile($this->nodes['right'])->raw(', ')->compile($this->nodes['left'])->raw(')');
         return;
     }
     if (isset(self::$functions[$operator])) {
         $compiler->raw(sprintf('%s(', self::$functions[$operator]))->compile($this->nodes['left'])->raw(', ')->compile($this->nodes['right'])->raw(')');
         return;
     }
     if (isset(self::$operators[$operator])) {
         $operator = self::$operators[$operator];
     }
     $compiler->raw('(')->compile($this->nodes['left'])->raw(' ')->raw($operator)->raw(' ')->compile($this->nodes['right'])->raw(')');
 }
 public function compile(Compiler $compiler)
 {
     $compiler->raw('((')->compile($this->nodes['expr1'])->raw(') ? (')->compile($this->nodes['expr2'])->raw(') : (')->compile($this->nodes['expr3'])->raw('))');
 }
Example #6
0
 public function compile(Compiler $compiler)
 {
     $compiler->raw('$' . $this->attributes['name']);
 }
 public function compile(Compiler $compiler)
 {
     $compiler->repr($this->attributes['value']);
 }
Example #8
0
 public function compile(Compiler $compiler)
 {
     $compiler->raw('(')->raw(self::$operators[$this->attributes['operator']])->compile($this->nodes['node'])->raw(')');
 }