protected function tokenizeEscapedString($s, $pos)
{
$quote = $s[$pos];
$pos = $pos + 1;
$start = $pos;
while (1) {
$next = strpos($s, $quote, $pos);
if (false === $next) {
throw new SyntaxError(sprintf('Expected closing %s for string in: %s', $quote, substr($s, $start)));
}
$result = substr($s, $start, $next - $start);
if ('\\' === $result[strlen($result) - 1]) {
// next quote character is escaped
$pos = $next + 1;
continue;
}
if (false !== strpos($result, '\\')) {
$result = $this->unescapeStringLiteral($result);
}
return array($result, $next + 1);
}
}