public function SimpleArithmeticExpression()
{
$terms = array();
$terms[] = $this->ArithmeticTerm();
while (($isPlus = $this->_lexer->isNextToken(Lexer::T_PLUS)) || $this->_lexer->isNextToken(Lexer::T_MINUS)) {
$this->match(($isPlus) ? Lexer::T_PLUS : Lexer::T_MINUS);
$terms[] = $this->_lexer->token['value'];
$terms[] = $this->ArithmeticTerm();
}
// Phase 1 AST optimization: Prevent AST\SimpleArithmeticExpression
// if only one AST\ArithmeticTerm is defined
if (count($terms) == 1) {
return $terms[0];
}
return new AST\SimpleArithmeticExpression($terms);
}