extensions = $extensions; $this->syntaxes = $syntaxes; $this->controlStructures = $controlStructure; } public function registerAll(Compiler $compiler) : void { $this->registerSyntax($compiler); $this->registerControlStructure($compiler); $this->registerExtension($compiler); } public function registerSyntax(Compiler $compiler) : void { $compiler->registerSyntax(new \Picea\Syntax\PhpTagToken()); $compiler->registerSyntax(new \Picea\Syntax\CommentToken()); $compiler->registerSyntax(new \Picea\Syntax\EchoRawToken()); $compiler->registerSyntax(new \Picea\Syntax\EchoSafeToken()); foreach($this->syntaxes ?? [] as $syntax) { $compiler->registerSyntax($syntax); } } public function registerControlStructure(Compiler $compiler) : void { $compiler->registerControlStructure(new \Picea\ControlStructure\NamespaceToken()); $compiler->registerControlStructure(new \Picea\ControlStructure\UseToken()); $compiler->registerControlStructure(new \Picea\ControlStructure\IfToken()); $compiler->registerControlStructure(new \Picea\ControlStructure\ForeachToken()); $compiler->registerControlStructure(new \Picea\ControlStructure\ForToken()); $compiler->registerControlStructure(new \Picea\ControlStructure\OrToken()); $compiler->registerControlStructure(new \Picea\ControlStructure\SwitchToken()); $compiler->registerControlStructure(new \Picea\ControlStructure\DefaultToken()); $compiler->registerControlStructure(new \Picea\ControlStructure\BreakToken()); $compiler->registerControlStructure(new \Picea\ControlStructure\ContinueToken()); $compiler->registerControlStructure(new \Picea\ControlStructure\ExtendsToken()); $compiler->registerControlStructure(new \Picea\ControlStructure\SectionToken()); $compiler->registerControlStructure(new \Picea\ControlStructure\FunctionToken()); $compiler->registerControlStructure(new \Picea\ControlStructure\BlockToken()); $compiler->registerControlStructure(new \Picea\ControlStructure\IncludeToken()); $compiler->registerControlStructure(new \Picea\ControlStructure\ViewToken()); foreach($this->controlStructures ?? [] as $controlStructure) { $compiler->registerControlStructure($controlStructure); } } public function registerExtension(Compiler $compiler) : void { $compiler->registerExtension(new \Picea\Extension\PhpExtension()); $compiler->registerExtension(new \Picea\Extension\PrintExtension()); $compiler->registerExtension(new \Picea\Extension\JsonExtension()); foreach($this->extensions ?? [] as $extension) { $compiler->registerExtension($extension); } } }