- Base is done; most of the language's components are now working!

- Implemented OPCACHE caching
- Added View() token logic
- New FileFetcher added to gather files from given view path
This commit is contained in:
mcndave committed 2019-11-01 14:46:01 -04:00
1 parent bcd49884fc
commit 6701a1cd59
16 files changed
+323 -69

No files matched your search

+1 -1
View File
@@ -12,7 +12,7 @@ class EndSectionToken implements ControlStructure {
}
$section = array_pop($context->sections);
$build = $context->extendFrom ? "" : "\$this->__renderSection({$section['name']});";
$build = $context->extendFrom ? "" : "\$___class__template->renderSection({$section['name']});";
return "<?php }]; $build?>";
}
}
+6 -6
View File
@@ -13,8 +13,8 @@ class SectionToken implements ControlStructure {
$options = eval($options);
}
if ( ! ctype_alnum(str_replace([".", "\"", "'"], "", $name)) ) {
throw new \RuntimeException("Your section named `{$name}` contains invalid character. Allowed are only letters, numbers and dots");
if ( ! ctype_alnum(str_replace([".", "\"", "'", "-", "_"], "", $name)) ) {
throw new \RuntimeException("Your section named `{$name}` contains invalid character. Allowed are only letters, numbers, dashes, underscores and dots");
}
$context->sections[] = [
@@ -28,10 +28,10 @@ class SectionToken implements ControlStructure {
throw new \RuntimeException("An unsupported action `$action` was given as an option of a {% section %} tag");
}
$order = $options['order'] ?? "count(\$this->__section_list[$name]['$action'])";
$order = $options['order'] ?? "count(\$___class__template->sectionList[$name]['$action'])";
return "<?php \$this->__section_list[$name] ??= [ 'prepend' => [], 'append' => [], 'default' => [] ];
\$this->__section_list[$name]['$action'][] = [ 'order' => $order, 'callback' => function() {
extract(\$this->__variables_list); ?>";
return "<?php \$___class__template->sectionList[$name] ??= [ 'prepend' => [], 'append' => [], 'default' => [] ];
\$___class__template->sectionList[$name]['$action'][] = [ 'order' => $order, 'callback' => function() use (\$___class__template, \$___global_variables, \$___variables) {
extract(\$___global_variables); extract(\$___variables, \EXTR_OVERWRITE); ?>";
}
}
+1 -2
View File
@@ -7,7 +7,6 @@ class ViewToken implements ControlStructure {
public string $token = "view";
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments, string $token) {
#$context->switchStack[] = true;
#return "<?php switch($arguments):";
return "<?php echo \$___class__template->picea->renderHtml($arguments, get_defined_vars()); ?>";
}
}