diff --git a/src/Flow/Flow.php b/src/Flow/Flow.php index 7c3cbe8..3afa8f8 100644 --- a/src/Flow/Flow.php +++ b/src/Flow/Flow.php @@ -254,6 +254,18 @@ protected function replaceOne($command, $data, $text) return $this->replace($command, $data, $text, 1); } + protected function _compile(&$to, $compile = null) + { + foreach ($this->lexer($compile ?: $to) as $command) + { + $to = $this->replaceOne( + '{' . $command . '}', + $this->token($command), + $to + ); + } + } + /** * @return mixed|string * @@ -265,15 +277,15 @@ protected function compile() $compile = $this->removePhpTags($compile); $compile = $this->literal($compile); - foreach ($this->lexer($compile) as $command) + preg_match_all('~"(\X+?)"~', $compile, $matches); + + foreach ($matches[1] as $match) { - $compile = $this->replaceOne( - '{' . $command . '}', - $this->token($command), - $compile - ); + $this->_compile($compile, $match); } + $this->_compile($compile); + return $compile; }