private function getArrayValue()
{
$result = array();
$dataType = null;
$lastType = null;
$value = null;
while (Lexer::TOKEN_RBRANK != $this->lexer->getToken()->getType()) {
switch ($this->lexer->getCurrentToken()->getType()) {
case Lexer::TOKEN_COMMA:
if ($dataType == null) {
throw new ParseException('Expected data type before comma', $this->currentLine, $value);
}
break;
case Lexer::TOKEN_QUOTES:
case Lexer::TOKEN_TRIPLE_QUOTES:
case Lexer::TOKEN_QUOTE:
case Lexer::TOKEN_TRIPLE_QUOTE:
$lastType = 'string';
$dataType = $dataType == null ? $lastType : $dataType;
$value = $this->getStringValue($this->lexer->getCurrentToken());
$result[] = $value;
break;
case Lexer::TOKEN_LBRANK:
$lastType = 'array';
$dataType = $dataType == null ? $lastType : $dataType;
$result[] = $this->getArrayValue();
break;
case Lexer::TOKEN_LITERAL:
$value = $this->getLiteralValue();
$lastType = gettype($value);
$dataType = $dataType == null ? $lastType : $dataType;
$result[] = $value;
break;
case Lexer::TOKEN_HASH:
$this->processComment();
break;
case Lexer::TOKEN_NEWLINE:
$this->currentLine++;
break;
case Lexer::TOKEN_RBRANK:
break;
default:
throw new ParseException('Syntax error', $this->currentLine, $this->lexer->getCurrentToken()->getValue());
}
if ($lastType != $dataType) {
throw new ParseException('Data types cannot be mixed in an array', $this->currentLine, $value);
}
}
return $result;
}