public function handleCodeInbetween(&$separators, &$result)
{
$scanSeparators = $this->scanSeparators($separators, $result);
$input = $this->input;
return function () use(&$separators, $input, $scanSeparators) {
$arguments = array();
$start = current($separators);
$endPair = array('[' => ']', '{' => '}', '(' => ')', ',' => false);
$open = $start[0];
$close = $endPair[$start[0]];
$count = $scanSeparators($arguments, $open, $close);
if ($close && $count > 0) {
throw new \ErrorException($input . "\nMissing closing: " . $close, 14);
}
if (($sep = current($separators)) !== false) {
$end = next($separators);
if ($end[0] === null && $sep[1] < $end[1]) {
$key = count($arguments) - 1;
$arguments[$key] .= substr($input, $sep[1] + 1, $end[1] - $sep[1] - 1);
}
}
return $arguments;
};
}