picea/src/Syntax/EchoRawToken.php
Dave Mc Nicoll bb29a56077 - Added while/endwhile and do/while syntaxes
- Fix the abstractclass requirement of parse() function
2022-12-19 19:36:39 +00:00

21 lines
509 B
PHP

<?php
namespace Picea\Syntax;
class EchoRawToken implements Syntax {
public string $tokenOpen = "\{\{=";
public string $tokenClose = "\}\}";
public function parse(\Picea\Compiler\Context &$content, string &$sourceCode)
{
$sourceCode = preg_replace_callback("#({$this->tokenOpen})(.*?)({$this->tokenClose})#s", function ($matches) {
$line = trim($matches[2], " \t\n\r\0\x0B;");
return "<?php echo {$line} ?>";
}, $sourceCode);
}
}