Compile an expression and return the corresponding executable

@param string $expression
@return \FormulaInterpreter\Executable
413
function compile($expression) {
        $options = $this->parser->parse($expression);
        $command = $this->commandFactory->create($options);
        return new Executable($command, $this->variables);
    }
956851
public function postProcessExpression(Expression $expression)
    {
        if ($this->hasHash($expression->hashCode())) {
            $alias = $this->getAlias($expression->hashCode());
            $alias = new Expr\Column($alias);
            $alias->setBuilder($this);
            $expression = new Expr\Raw(sprintf('%s AS %s', $expression->toSQL(), $alias->toSQL()));
        }
        
        return $expression;
    }
689276
public function walkCaseExpression($expression)
    {
        switch (true) {
            case ($expression instanceof AST\CoalesceExpression):
                return $this->walkCoalesceExpression($expression);

            case ($expression instanceof AST\NullIfExpression):
                return $this->walkNullIfExpression($expression);

            case ($expression instanceof AST\GeneralCaseExpression):
                return $this->walkGeneralCaseExpression($expression);

            case ($expression instanceof AST\SimpleCaseExpression):
                return $this->walkSimpleCaseExpression($expression);

            default:
                return '';
        }
    }
1045219
protected function compileExtendsStack($expression)
    {
        foreach (['Block', 'EndBlock', 'Include', 'Inject', 'Extends'] as $token) {
            $out = $this->{'compile'.$token}($expression);

            if (strlen($out) !== 0) {
                $expression = $out;
            }
        }

        return $expression;
    }
1097992
protected function compileBlock($expression)
    {
        $output = preg_replace_callback(
            "/\n*\#block\s*\((.+?)(?:,(.+?))?\)\n*/m",
            function ($match) {
                array_shift($match);

                $content = null;

                if (count($match) == 2) {
                    $content = $match[1];
                }

                if (is_null($content)) {
                    return "<?php \$__tintin->getStackManager()->startStack({$match[0]}); ?>";
                } else {
                    return "<?php \$__tintin->getStackManager()->startStack({$match[0]}, $content); ?>";
                }
            },
            $expression
        );

        return $output == $expression ? '' : $output;
    }
114864
protected function compileLoopStack($expression)
    {
        foreach ($this->getLoopStack() as $token) {
            $out = $this->{'compile'.$token}($expression);

            if (strlen($out) !== 0) {
                $expression = $out;
            }
        }

        return $expression;
    }
1261925
private function fetchExpression($expression)
    {
        $selectors = explode(',', $expression);
        $paths = [];

        foreach ($selectors as $selector) {
            $selector = trim($selector);

            if (array_key_exists($selector, $this->compiledExpressions)) {
                $paths[] = $this->compiledExpressions[ $selector ];

                continue;
            }

            $this->compiledExpressions[ $selector ] = $this->fetchCssExpression($selector);

            $paths[] = $this->compiledExpressions[ $selector ];
        }

        return implode('|', $paths);
    }
675822
public function _eval($expression)
    {
        $code = new Code();
        $code->addStatement($expression);

        return $this->adapter->run($code);
    }
630502
protected function compileInject( $expression )
	{
		$segments = $this->parseSegments( $expression, 2 );

		return '<?php $' . trim( $segments[0] ) . " = app('" . trim( $segments[1] ) . "'); ?>";
	}
817482
public function withExpression(string $expression): self
    {
        if (!(new \ReflectionClass($expression))->implementsInterface(Expression::class)) {
            throw new DomainException($expression);
        }

        $self = clone $this;
        $self->expression = new $expression($self->name);

        return $self;
    }
808382
public function setExpression(Expression $expression)
    {
        $this->map['expressions']->set($expression->hashCode(), $expression->setBuilder($this));
        
        return $this;
    }
900392
public function addExpressionCondition($expression) {
        if(!isset($this->_subscription->subject)){
            $this->_subscription->subject = (object) [];
        }

        if(!isset($this->_subscription->subject->condition)){
            $this->_subscription->subject->condition = (object) [];
        }


        $this->_subscription->subject->condition->expression = $expression;
        return $this;
    }
470852
protected function compileInject($expression)
    {
        $regex = "/\#inject\s*\(((?:\n|\s|\t)*(?:.+?)(?:\n|\s|\t)*)\)/sm";

        $output = preg_replace_callback($regex, function ($match) {
            return "<?php echo \$__tintin->getStackManager()->getStack({$match[1]}); ?>";
        }, $expression);

        return $output == $expression ? '' : $output;
    }
459836
protected function compileExtends($expression) {
        if (Str::startsWith($expression, '(')) {
            $expression = substr($expression, 1, -1);
        }

        $data = "<?php echo \$__env->make($expression, array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>";

        $this->footer[] = $data;

        return '';
    }
346490
public function dispatch(Expression $expr)
    {
        switch (true) {
            case $expr instanceof Comparison:
                return $this->walkComparison($expr);
            case $expr instanceof Value:
                return $this->walkValue($expr);
            case $expr instanceof CompositeExpression:
                return $this->walkCompositeExpression($expr);
            default:
                throw new RuntimeException('Unknown Expression ' . get_class($expr));
        }
    }
611231
protected function compileEndIf($expression)
    {
        $output = preg_replace_callback('/\n*(#endif|#endunless)\n*/', function ($match) {
            array_shift($match);

            return "<?php endif; ?>";
        }, $expression);

        return $output == $expression ? '' : $output;
    }
1119776
public function evaluate($expression)
    {
        $lexer = $this->getLexer();
        $tokens = $lexer->tokenize($expression);

        $translationStrategy = new \Math\TranslationStrategy\ShuntingYard();

        return $this->evaluateRPN($translationStrategy->translate($tokens));
    }