public function ArithmeticPrimary()
{
if ($this->_lexer->isNextToken(Lexer::T_OPEN_PARENTHESIS)) {
$this->match(Lexer::T_OPEN_PARENTHESIS);
$expr = $this->SimpleArithmeticExpression();
$this->match(Lexer::T_CLOSE_PARENTHESIS);
return $expr;
}
switch ($this->_lexer->lookahead['type']) {
case Lexer::T_IDENTIFIER:
$peek = $this->_lexer->glimpse();
if ($peek['value'] == '(') {
return $this->FunctionDeclaration();
}
if ($peek['value'] == '.') {
return $this->SingleValuedPathExpression();
}
return $this->StateFieldPathExpression();
case Lexer::T_INPUT_PARAMETER:
return $this->InputParameter();
default:
$peek = $this->_lexer->glimpse();
if ($peek['value'] == '(') {
if ($this->_isAggregateFunction($this->_lexer->lookahead['type'])) {
return $this->AggregateExpression();
}
return $this->FunctionDeclaration();
} else {
return $this->Literal();
}
}
}