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