- First task of v2 done, tokens can now have unlimited options attached to it

This commit is contained in:
mcndave committed 2023-02-02 16:46:46 +00:00
1 parent afeb8789b5
commit acd9f8c72e
8 files changed
+82 -41

No files matched your search

+12 -6
View File
@@ -4,14 +4,20 @@ namespace Picea\ControlStructure;
class SectionToken implements ControlStructure {
public array $token = [ "section", "section.prepend", "section.append", "endsection" ];
public array $token = [ "section", "endsection" ];
public function parse(\Picea\Compiler\Context &$context, ?string $arguments, string $token)
{
$opt = $context->tokenOptions($token);
if (in_array('prepend', $opt)) {
$context->sectionAction = "prepend";
}
elseif (in_array('append', $opt)) {
$context->sectionAction = "append";
}
public function parse(\Picea\Compiler\Context &$context, ?string $arguments, string $token) {
switch($token) {
case "section.prepend":
$context->sectionAction = "prepend";
case "section.append":
$context->sectionAction ??= "append";
case "section":
return $this->printSection($context, $arguments);