示例#1
0
 /**
  * @param $expression
  * @return Queue
  */
 public function parse($expression)
 {
     $oQueue = Tokenizer::tokenizeExpression($expression);
     while ($oQueue->hasItems()) {
         $oCurrentToken = $oQueue->shift();
         $this->_processToken($oCurrentToken);
     }
     while ($this->_operator_stack->hasOperators()) {
         $oTopOperator = $this->_operator_stack->pop();
         if ($oTopOperator instanceof Parenthesis) {
             throw new MismatchingParenthesisException();
         }
         $this->_output_queue->enqueue($oTopOperator);
     }
     return $this->_output_queue;
 }