protected function openString($end, &$out, $nestingOpen = null)
{
$oldWhite = $this->eatWhiteDefault;
$this->eatWhiteDefault = false;
$patt = '(.*?)([\'"]|#\\{|' . $this->pregQuote($end) . '|' . static::$commentPattern . ')';
$nestingLevel = 0;
$content = [];
while ($this->match($patt, $m, false)) {
if (isset($m[1]) && $m[1] !== '') {
$content[] = $m[1];
if ($nestingOpen) {
$nestingLevel += substr_count($m[1], $nestingOpen);
}
}
$tok = $m[2];
$this->count -= strlen($tok);
if ($tok === $end && !$nestingLevel--) {
break;
}
if (($tok === "'" || $tok === '"') && $this->string($str)) {
$content[] = $str;
continue;
}
if ($tok === '#{' && $this->interpolation($inter)) {
$content[] = $inter;
continue;
}
$content[] = $tok;
$this->count += strlen($tok);
}
$this->eatWhiteDefault = $oldWhite;
if (count($content) === 0) {
return false;
}
// trim the end
if (is_string(end($content))) {
$content[count($content) - 1] = rtrim(end($content));
}
$out = [Type::T_STRING, '', $content];
return true;
}