public function surveyToken($token)
{
if ($this->checkNext) {
$this->checkNext = false;
if (!is_string($token) || $token != ':') {
// dropping non-alternative if.
array_pop($this->association);
}
}
if (is_array($token)) {
if (isset($this->waitFor['array'][$token[3]])) {
$this->association[] = $this->waitFor['array'][$token[3]];
if (isset($this->tokenWithParenthesis[$token[3]])) {
$this->parenthesisStack[$this->parenthesisLevel] = 1;
}
if ($token[3] == 'T_ELSE') {
$this->checkNext = true;
}
}
} else {
if (isset($this->waitFor['string'][$token])) {
$this->association[] = $this->waitFor['string'][$token];
}
if ($token == '(') {
++$this->parenthesisLevel;
} elseif ($token == ')') {
--$this->parenthesisLevel;
if (isset($this->parenthesisStack[$this->parenthesisLevel])) {
$this->checkNext = true;
unset($this->parenthesisStack[$this->parenthesisLevel]);
}
}
}
return null;
}