- Added a new {% block ... %} token
- Added a new {% php ... %} token
- Fixed a bug with an OR if foreach is empty
This commit is contained in:
1 parent
0e201b77f2
commit
404d1f4359
9 files changed
+143
-22
No files matched your search
@@ -4,6 +4,8 @@ namespace Picea\Language;
|
||||
|
||||
use Picea\Compiler;
|
||||
|
||||
use Picea\Compiler\Context;
|
||||
|
||||
class DefaultRegistrations implements LanguageRegistration
|
||||
{
|
||||
protected array $extensions;
|
||||
@@ -12,8 +14,11 @@ class DefaultRegistrations implements LanguageRegistration
|
||||
|
||||
protected array $controlStructures;
|
||||
|
||||
public function __construct(array $extensions = [], array $syntaxes = [], array $controlStructure = [])
|
||||
protected ? Context $context;
|
||||
|
||||
public function __construct(? Context $context = null, array $extensions = [], array $syntaxes = [], array $controlStructure = [])
|
||||
{
|
||||
$this->context = $context;
|
||||
$this->extensions = $extensions;
|
||||
$this->syntaxes = $syntaxes;
|
||||
$this->controlStructures = $controlStructure;
|
||||
@@ -63,6 +68,7 @@ class DefaultRegistrations implements LanguageRegistration
|
||||
$compiler->registerControlStructure(new \Picea\ControlStructure\ExtendsToken());
|
||||
$compiler->registerControlStructure(new \Picea\ControlStructure\SectionToken());
|
||||
$compiler->registerControlStructure(new \Picea\ControlStructure\EndSectionToken());
|
||||
$compiler->registerControlStructure(new \Picea\ControlStructure\BlockToken());
|
||||
$compiler->registerControlStructure(new \Picea\ControlStructure\ViewToken());
|
||||
|
||||
foreach($this->controlStructures ?? [] as $controlStructure) {
|
||||
@@ -72,7 +78,7 @@ class DefaultRegistrations implements LanguageRegistration
|
||||
|
||||
public function registerExtension(Compiler $compiler) : void
|
||||
{
|
||||
$compiler->registerExtension(new \Picea\Extension\JsonExtension());
|
||||
$compiler->registerExtension(new \Picea\Extension\JsonExtension($this->context));
|
||||
$compiler->registerExtension(new \Picea\Extension\AssetExtension());
|
||||
|
||||
foreach($this->extensions ?? [] as $extension) {
|
||||
|
||||
Reference in new issue
Block a user