Registers the Fortune directive transpilers

@param ITranspiler $transpiler The transpiler to register to
338753
public function registerDirectiveTranspilers(ITranspiler $transpiler)
    {
        $transpiler->registerDirectiveTranspiler('else', function () {
            return '<?php else: ?>';
        });
        $transpiler->registerDirectiveTranspiler('elseif', function ($expression) {
            return '<?php elseif' . $expression . ': ?>';
        });
        $transpiler->registerDirectiveTranspiler('forelse', function () {
            return '<?php endforeach; if(array_pop($__opulenceForElseEmpty)): ?>';
        });
        $transpiler->registerDirectiveTranspiler('endforeach', function () {
            return '<?php endforeach; ?>';
        });
        $transpiler->registerDirectiveTranspiler('endif', function () {
            return '<?php endif; ?>';
        });
        $transpiler->registerDirectiveTranspiler('endfor', function () {
            return '<?php endfor; ?>';
        });
        $transpiler->registerDirectiveTranspiler('endpart', function () {
            return '<?php $__opulenceFortuneTranspiler->endPart(); ?>';
        });
        $transpiler->registerDirectiveTranspiler('endwhile', function () {
            return '<?php endwhile; ?>';
        });
        $transpiler->registerDirectiveTranspiler('extends', function ($expression) use ($transpiler) {
            // Create the parent
            $code = '$__opulenceViewParent = $__opulenceViewFactory->createView' . $expression . ';';
            $code .= '$__opulenceFortuneTranspiler->addParent($__opulenceViewParent, $__opulenceView);';
            $code .= 'extract($__opulenceView->getVars());';
            $transpiler->prepend('<?php ' . $code . ' ?>');

            // Compile the parent, keep track of the contents, and echo them in the appended text
            $code = '$__opulenceParentContents = isset($__opulenceParentContents) ? $__opulenceParentContents : [];';
            $code .= '$__opulenceParentContents[] = $__opulenceFortuneTranspiler->transpile($__opulenceViewParent);';
            $transpiler->prepend('<?php ' . $code . ' ?>');

            // Echo the contents at the end of the content
            $code = 'echo eval("?>" . array_shift($__opulenceParentContents));';
            $transpiler->append('<?php ' . $code . ' ?>');

            return '';
        });
        $transpiler->registerDirectiveTranspiler('for', function ($expression) {
            return '<?php for' . $expression . ': ?>';
        });
        $transpiler->registerDirectiveTranspiler('foreach', function ($expression) {
            return '<?php foreach' . $expression . ': ?>';
        });
        $transpiler->registerDirectiveTranspiler('forif', function ($expression) {
            $code = '<?php if(!isset($__opulenceForElseEmpty)): $__opulenceForElseEmpty = []; endif;';
            $code .= '$__opulenceForElseEmpty[] = true;';
            $code .= 'foreach' . $expression . ':';
            $code .= '$__opulenceForElseEmpty[count($__opulenceForElseEmpty) - 1] = false; ?>';

            return $code;
        });
        $transpiler->registerDirectiveTranspiler('if', function ($expression) {
            return '<?php if' . $expression . ': ?>';
        });
        $transpiler->registerDirectiveTranspiler('include', function ($expression) {
            // Check if a list of variables were passed in as a second parameter
            if (
                preg_match(
                    "/^\(((('|\")(.*)\\3)|\\$[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*),\s*(.+)\)$/U",
                    $expression,
                    $matches
                ) === 1
            ) {
                $sharedVars = trim($matches[5]);
                $factoryCreateCall = 'createView(' . $matches[1] . ')';
            } else {
                $sharedVars = '[]';
                $factoryCreateCall = 'createView' . $expression;
            }

            // Create an isolate scope for the included view
            $code = 'call_user_func(function() use ($__opulenceViewFactory, $__opulenceFortuneTranspiler){';
            $code .= '$__opulenceIncludedView = $__opulenceViewFactory->' . $factoryCreateCall . ';';
            $code .= 'extract($__opulenceIncludedView->getVars());';
            // Extract any shared vars, which will override any identically-named view vars
            $code .= 'if(count(func_get_arg(0)) > 0){extract(func_get_arg(0));}';
            $code .= 'eval("?>" . $__opulenceFortuneTranspiler->transpile($__opulenceIncludedView));';
            $code .= '}, ' . $sharedVars . ');';

            return "<?php $code ?>";
        });
        $transpiler->registerDirectiveTranspiler('parent', function () {
            // This placeholder will be overwritten later
            return '__opulenceParentPlaceholder';
        });
        $transpiler->registerDirectiveTranspiler('part', function ($expression) {
            return '<?php $__opulenceFortuneTranspiler->startPart' . $expression . '; ?>';
        });
        $transpiler->registerDirectiveTranspiler('show', function ($expression) {
            $expression = empty($expression) ? '()' : $expression;

            return '<?php echo $__opulenceFortuneTranspiler->showPart' . $expression . '; ?>';
        });
        $transpiler->registerDirectiveTranspiler('while', function ($expression) {
            return '<?php while' . $expression . ': ?>';
        });
    }
989871
public function register(Renderer $renderer) {
        $this->registerTokenRenderer(CodeRule::NAME . CodeRule::OPEN, 'renderOpen', $renderer);
        $this->registerTokenRenderer(CodeRule::NAME . CodeRule::CLOSE, 'renderClose', $renderer);
        $this->registerTokenRenderer(CodeRule::NAME, 'renderContent', $renderer);

        $this->registerTokenRenderer(CodeAltRule::NAME . CodeAltRule::OPEN, 'renderOpen', $renderer);
        $this->registerTokenRenderer(CodeAltRule::NAME . CodeAltRule::CLOSE, 'renderClose', $renderer);
        $this->registerTokenRenderer(CodeAltRule::NAME, 'renderContent', $renderer);
    }
1157216
function createTranspiler ({ mappers = {}, initialScopeData } = {}) {
  const config = {
    scope: createScope(initialScopeData),
    mappers
  };

  return (config.decoratedTranspile = transpile.bind(null, config));
}
266895
public function setParamTransformer(\chilimatic\lib\interfaces\IFlyWeightTransformer $paramTransformer)
    {
        $this->paramTransformer = $paramTransformer;

        return $this;
    }
647918
public static void initialize(Retransformer trans) throws Exception {
        transformer = trans;

        List<String> scripts = new ArrayList<>();
        List<String> scriptNames = new ArrayList<>();

        // Load default and custom rules
        Enumeration<URL> iter = ClassLoader.getSystemResources(ROOT_RULE_FOLDER);
        while (iter.hasMoreElements()) {
            loadRules(iter.nextElement().toURI(), scriptNames, scripts);
        }

        try (PrintWriter writer = new PrintWriter(new StringWriter())) {
            try {
                transformer.installScript(scripts, scriptNames, writer);
            } catch (Exception e) {
                log.log(Level.SEVERE, "Failed to install scripts", e);
            }
        }

        if (log.isLoggable(Level.FINE)) {
            log.fine("Installed rules");
        }
    }
539376
protected function registerTraslator()
    {
        $this->app->singleton('translator', function ($app) {
            $loader = $app['translation.loader'];

            // When registering the translator component, we'll need to set the default
            // locale as well as the fallback locale. So, we'll grab the application
            // configuration so we can easily get both of these values from there.
            $locale = $app['config']['app.locale'];

            $trans = new Translator($loader, $locale);

            $trans->setFallback($app['config']['app.fallback_locale']);

            return $trans;
        });
    }
696025
public function registerBladeEngine($resolver)
    {
        // The Compiler engine requires an instance of the CompilerInterface, which in
        // this case will be the Blade compiler, so we'll first create the compiler
        // instance to pass into the engine so it can compile the views properly.
        $this->app->singleton('blade.compiler', function () {
            return new BladeCompiler(
                $this->app['files'], $this->app['config']['view.compiled']
            );
        });

        $resolver->register('blade', function () {
            return new CompilerEngine($this->app['blade.compiler']);
        });
    }
374967
public function transformNumbersBySplittingIntoPowerAwareTriplets(
        NumberToTripletsConverter $numberToTripletsConverter,
        PowerAwareTripletTransformer $powerAwareTripletTransformer
    ) {
        $this->numberTransformer->setNumberToTripletsConverter($numberToTripletsConverter);
        $this->numberTransformer->setPowerAwareTripletTransformer($powerAwareTripletTransformer);

        return $this;
    }
468130
public function registerBladeEngine($resolver)
    {
        // The Compiler engine requires an instance of the CompilerInterface, which in
        // this case will be the Blade compiler, so we'll first create the compiler
        // instance to pass into the engine so it can compile the views properly.
        $this->plugin->singleton('blade.compiler', function () {
            return new BladeCompiler(
                $this->plugin['files'], $this->plugin['config']['view.compiled']
            );
        });

        $resolver->register('blade', function () {
            return new CompilerEngine($this->plugin['blade.compiler']);
        });
    }
1235689
public function register(BladeCompiler $blade): void
    {
        if ($this->namespace) {
            $blade->directive("namespace", function ($parameter) {
                return "<?php namespace {$parameter} ?>";
            });
        }

        if ($this->use) {
            $blade->directive("use", function ($parameter) {
                return "<?php use {$parameter} ?>";
            });
        }

        if ($this->css !== null) {
            $blade->directive("css", function ($parameter) {
                assert(is_string($this->css));
                $file = $this->assetify($parameter, "css", $this->css);
                return "<link rel='stylesheet' type='text/css' href='{$file}'>";
            });
        }

        if ($this->js !== null) {
            $blade->directive("js", function ($parameter) {
                assert(is_string($this->js));
                $file = $this->assetify($parameter, "js", $this->js);
                return "<script type='text/javascript' src='{$file}'></script>";
            });
        }
    }
556223
public static function register(Configurator $configurator)
	{
		$configurator->onCompile[] = function($configurator, $compiler) {
			$compiler->addExtension('rest', new RestExtension());
		};
	}
165755
void addTranscoderAt(Transcoder transcoder, int i) {
        if (numTranscoders == elements.length) {
            EConvElement[] tmp = new EConvElement[elements.length * 2];
            System.arraycopy(elements, 0, tmp, 0, i);
            System.arraycopy(elements, i, tmp, i + 1, elements.length - i);
            elements = tmp;
        } else {
            System.arraycopy(elements, i, elements, i + 1, elements.length - i - 1);
        }

        elements[i] = new EConvElement(transcoder.transcoding(0));
        elements[i].allocate(4096);
        numTranscoders++;

        if (!decorator(transcoder.source, transcoder.destination)) {
            for (int j = numTranscoders - 1; i <= j; j--) {
                Transcoding tc = elements[j].transcoding;
                Transcoder tr = tc.transcoder;
                if (!decorator(tr.source, tr.destination)) {
                    lastTranscoding = tc;
                    break;
                }
            }
        }
    }
266958
private static function registerAggregations(BladeCompiler $compiler)
    {
        $compiler->directive('money_min', function ($expression) {
            return "<?php echo money_min(${expression}); ?>";
        });

        $compiler->directive('money_max', function ($expression) {
            return "<?php echo money_max(${expression}); ?>";
        });

        $compiler->directive('money_avg', function ($expression) {
            return "<?php echo money_avg(${expression}); ?>";
        });

        $compiler->directive('money_sum', function ($expression) {
            return "<?php echo money_sum(${expression}); ?>";
        });
    }
1036689
public function registerInit(Smarty_Internal_TemplateCompilerBase $compiler, $initChildSequence = false)
    {
        if ($initChildSequence || !isset($compiler->_cache['inheritanceInit'])) {
            $compiler->registerPostCompileCallback(array('Smarty_Internal_Compile_Shared_Inheritance', 'postCompile'),
                                                   array($initChildSequence), 'inheritanceInit', $initChildSequence);

            $compiler->_cache['inheritanceInit'] = true;
        }
    }
1180272
protected function registerBladeEngine(EngineResolver $resolver)
    {
        $mySelf    = $this;
        $container = $this->container;

        // The Compiler engine requires an instance of the CompilerInterface, which in
        // this case will be the Blade compiler, so we'll first create the compiler
        // instance to pass into the engine so it can compile the views properly.
        $this->container->bindShared('blade.compiler', function ($container) use ($mySelf) {
            return new BladeCompiler($container['files'], $container['cache.path']);
        });

        // Register the blade view file finder to resolve to template
        $resolver->register('blade', function () use ($container) {
            return new CompilerEngine($container['blade.compiler'], $container['files']);
        });
    }
1268622
public function registerTplEngine($resolver)
    {
        $app = $this->app;

        $resolver->register('tpl', function() use ($app)
        {
            $cache = $app['path.storage'].'/views';

            // The Compiler engine requires an instance of the CompilerInterface, which in
            // this case will be the Blade compiler, so we'll first create the compiler
            // instance to pass into the engine so it can compile the views properly.
            $compiler = new TplCompiler($app['files'], $cache);


            return new CompilerEngine($compiler, $app['files']);
        });
    }
823639
private function registerTransChecker()
    {
        $this->singleton(Contracts\TransChecker::class, function (Application $app) {
            /**
             * @var  \Illuminate\Translation\Translator             $translator
             * @var  \Arcanedev\LaravelLang\Contracts\TransManager  $manager
             * @var  \Illuminate\Contracts\Config\Repository        $config
             */
            $translator = $app['translator'];
            $manager    = $app[Contracts\TransManager::class];
            $config     = $app['config'];

            return new TransChecker($translator, $manager, $config->get('laravel-lang', []));
        });
    }