21 lines
509 B
PHP
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);
|
|
}
|
|
|
|
}
|