private function processQuote()
{
$current = $this->id;
$fullcode = array();
$rank = -1;
if ($this->tokens[$current][0] === T_QUOTE) {
$stringId = $this->addAtom('String');
$finalToken = T_QUOTE;
$openQuote = '"';
$closeQuote = '"';
$type = T_QUOTE;
} elseif ($this->tokens[$current][0] === T_BACKTICK) {
$stringId = $this->addAtom('Shell');
$finalToken = T_BACKTICK;
$openQuote = '`';
$closeQuote = '`';
$type = T_BACKTICK;
} elseif ($this->tokens[$current][0] === T_START_HEREDOC) {
$stringId = $this->addAtom('Heredoc');
$finalToken = T_END_HEREDOC;
$openQuote = $this->tokens[$this->id][1];
if ($this->tokens[$this->id][1][3] === "'") {
$closeQuote = substr($this->tokens[$this->id][1], 4, -2);
} else {
$closeQuote = substr($this->tokens[$this->id][1], 3);
}
$type = T_START_HEREDOC;
}
while ($this->tokens[$this->id + 1][0] !== $finalToken) {
$currentVariableId = $this->id + 1;
if (in_array($this->tokens[$this->id + 1][0], array(T_CURLY_OPEN, T_DOLLAR_OPEN_CURLY_BRACES))) {
$openId = $this->id + 1;
++$this->id;
// Skip {
while (!in_array($this->tokens[$this->id + 1][0], array(T_CLOSE_CURLY))) {
$this->processNext();
}
++$this->id;
// Skip }
$partId = $this->popExpression();
$this->setAtom($partId, array('enclosing' => true, 'fullcode' => $this->tokens[$openId][1] . $this->atoms[$partId]['fullcode'] . '}', 'token' => $this->getToken($this->tokens[$currentVariableId][0])));
$this->pushExpression($partId);
} elseif ($this->tokens[$this->id + 1][0] === T_VARIABLE) {
$this->processNext();
if ($this->tokens[$this->id + 1][0] === T_OBJECT_OPERATOR) {
++$this->id;
$objectId = $this->popExpression();
$propertyNameId = $this->processNextAsIdentifier();
$propertyId = $this->addAtom('Property');
$this->setAtom($propertyId, array('code' => $this->tokens[$current][1], 'fullcode' => $this->atoms[$objectId]['fullcode'] . '->' . $this->atoms[$propertyNameId]['fullcode'], 'line' => $this->tokens[$current][2], 'variadic' => false, 'token' => $this->getToken($this->tokens[$current][0]), 'enclosing' => false));
$this->addLink($propertyId, $objectId, 'OBJECT');
$this->addLink($propertyId, $propertyNameId, 'PROPERTY');
$this->pushExpression($propertyId);
}
} else {
$this->processNext();
}
$partId = $this->popExpression();
if ($this->atoms[$partId]['atom'] === 'String') {
$this->setAtom($partId, array('noDelimiter' => $this->atoms[$partId]['code'], 'delimiter' => ''));
} else {
$this->setAtom($partId, array('noDelimiter' => '', 'delimiter' => ''));
}
$this->setAtom($partId, array('rank' => ++$rank));
$fullcode[] = $this->atoms[$partId]['fullcode'];
$this->addLink($stringId, $partId, 'CONCAT');
}
++$this->id;
$x = array('code' => $this->tokens[$current][1], 'fullcode' => $openQuote . implode('', $fullcode) . $closeQuote, 'line' => $this->tokens[$current][2], 'token' => $this->getToken($this->tokens[$current][0]), 'count' => $rank + 1);
if ($type === T_START_HEREDOC) {
$x['delimiter'] = $closeQuote;
$x['heredoc'] = $openQuote[3] !== "'";
}
$this->setAtom($stringId, $x);
$this->pushExpression($stringId);
return $stringId;
}