- Added a loop index in AbstractLoop control struct.

This commit is contained in:
Dave Mc Nicoll committed 2025-10-15 14:57:42 +00:00
1 parent e737e82d7e
commit ef95576d74
10 files changed
+73 -36

No files matched your search

+7 -4
View File
@@ -3,7 +3,7 @@
namespace Picea\ControlStructure;
class WhileToken extends AbstractLoop {
public array $token = [ "do", "while", "endwhile", ];
public array $token = [ "do", "while", "endwhile", "/while" ];
public function parse(\Picea\Compiler\Context &$context, ?string $arguments, string $token, array $options = []) : string {
switch($token) {
@@ -23,10 +23,13 @@ class WhileToken extends AbstractLoop {
return "<?php } while($arguments); ?>";
}
}
return $this->openLoop($context, $arguments, $token);
case "endwhile":
case "/while":
return $this->closeLoop($context, $arguments, $token);
}
return parent::parse($context, $arguments, $token);
}
}