- WIP on RAW token

- WIP on caching interface
- Work done on easing template rendering for the controller
This commit is contained in:
mcndave committed 2019-10-04 08:38:11 -04:00
1 parent f8e3dbd60f
commit bcd49884fc
37 files changed
+381 -107

No files matched your search

+1 -1
View File
@@ -6,7 +6,7 @@ class BreakToken implements ControlStructure {
public string $token = "break";
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments) {
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments, string $token) {
return "<?php break; ?>";
}
+1 -1
View File
@@ -6,7 +6,7 @@ class CaseToken implements ControlStructure {
public string $token = "case";
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments) {
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments, string $token) {
$output = "";
if ( $context->switchStack ) {
+1 -1
View File
@@ -3,5 +3,5 @@
namespace Picea\ControlStructure;
interface ControlStructure {
public function parse(\Picae\Compiler\Context &$context, string $sourceCode);
public function parse(\Picae\Compiler\Context &$context, string $sourceCode, string $token);
}
+1 -1
View File
@@ -6,7 +6,7 @@ class DefaultToken implements ControlStructure {
public string $token = "default";
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments) {
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments, string $token) {
$output = "";
if ( $context->switchStack ) {
+1 -1
View File
@@ -6,7 +6,7 @@ class ElseIfToken implements ControlStructure {
public string $token = "elseif";
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments) {
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments, string $token) {
return "<?php elseif ($arguments): ?>";
}
+1 -1
View File
@@ -6,7 +6,7 @@ class ElseToken implements ControlStructure {
public string $token = "else";
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments) {
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments, string $token) {
return "<?php else: ?>";
}
+1 -1
View File
@@ -6,7 +6,7 @@ class EndIfToken implements ControlStructure {
public string $token = "endif";
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments) {
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments, string $token) {
return "<?php endif ?>";
}
+12
View File
@@ -0,0 +1,12 @@
<?php
namespace Picea\ControlStructure;
class EndRawToken implements ControlStructure {
public string $token = "endraw";
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments, string $token) {
}
}
+1 -1
View File
@@ -6,7 +6,7 @@ class EndSectionToken implements ControlStructure {
public string $token = "endsection";
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments) {
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments, string $token) {
if ( empty($context->sections) ) {
throw new \RuntimeException("A section closing tag {% endsection %} was found without an opening {% section %} tag");
}
+1 -1
View File
@@ -6,7 +6,7 @@ class EndSwitchToken implements ControlStructure {
public string $token = "endswitch";
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments) {
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments, string $token) {
return "<?php endswitch; ?>";
}
}
+1 -1
View File
@@ -6,7 +6,7 @@ class EndforToken implements ControlStructure {
public string $token = "endfor";
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments) {
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments, string $token) {
if ( end($context->iterationStack)['or'] === false ) {
$output = "<?php endfor; ?>";
}
+1 -1
View File
@@ -6,7 +6,7 @@ class EndforeachToken implements ControlStructure {
public string $token = "endforeach";
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments) {
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments, string $token) {
if ( end($context->iterationStack)['or'] === false ) {
$output = "<?php endforeach; ?>";
}
+1 -1
View File
@@ -6,7 +6,7 @@ class ExtendsToken implements ControlStructure {
public string $token = "extends";
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $path) {
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $path, string $token) {
# Triming string's quotes
$path = trim($path, "\"\' \t");
+1 -1
View File
@@ -6,7 +6,7 @@ class ForToken implements ControlStructure {
public string $token = "for";
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments) {
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments, string $token) {
$uid = "$".uniqid("for_");
$context->iterationStack[] = [
+1 -1
View File
@@ -6,7 +6,7 @@ class ForeachToken implements ControlStructure {
public string $token = "foreach";
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments) {
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments, string $token) {
$uid = "$".uniqid("foreach_");
$context->iterationStack[] = [
+1 -1
View File
@@ -6,7 +6,7 @@ class IfToken implements ControlStructure {
public string $token = "if";
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments) {
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments, string $token) {
return "<?php if ($arguments): ?>";
}
+1 -1
View File
@@ -6,7 +6,7 @@ class NamespaceToken implements ControlStructure {
public string $token = "namespace";
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments) {
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments, string $token) {
$context->namespace = $arguments;
return "";
}
+1 -1
View File
@@ -6,7 +6,7 @@ class OrToken implements ControlStructure {
public string $token = "or";
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments) {
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments, string $token) {
if ( empty($context->iterationStack) ) {
throw new \LogicException("Token `or` was used outside of iterator. Make sure your `for` or `foreach` declaration are properly made.");
}
+12
View File
@@ -0,0 +1,12 @@
<?php
namespace Picea\ControlStructure;
class RawToken implements ControlStructure {
public string $token = "raw";
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments, string $token) {
}
}
+1 -1
View File
@@ -6,7 +6,7 @@ class SectionToken implements ControlStructure {
public string $token = "section";
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments) {
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments, string $token) {
list($name, $options) = array_pad(explode(',', $arguments), 2, null);
if ( $options ?? false ) {
+1 -1
View File
@@ -6,7 +6,7 @@ class SwitchToken implements ControlStructure {
public string $token = "switch";
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments) {
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments, string $token) {
$context->switchStack[] = true;
return "<?php switch($arguments):";
}
+1 -1
View File
@@ -6,7 +6,7 @@ class UseToken implements ControlStructure {
public string $token = "use";
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments) {
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments, string $token) {
$context->useStack[] = $arguments;
return "";
}
+1 -1
View File
@@ -6,7 +6,7 @@ class ViewToken implements ControlStructure {
public string $token = "view";
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments) {
public function parse(/*\Picae\Compiler\Context*/ &$context, ?string $arguments, string $token) {
#$context->switchStack[] = true;
#return "<?php switch($arguments):";
}