示例#1
0
 /**
  * @param Lexer $lexer
  * @param char $char
  */
 public function input(Lexer $lexer, $char)
 {
     if ($char == "'") {
         $lexer->setStateString();
     } else {
         if (self::isAlpha($char)) {
             $lexer->setStateSymbol($char);
         } else {
             if ($char == '-' || $char == '+') {
                 $lexer->pushOperator(new TokenUnarySign($char));
             } else {
                 if (self::isDigit($char)) {
                     $lexer->setStateInteger($char);
                 } else {
                     if ($char == '(') {
                         $lexer->pushOperator(new TokenLParen());
                     } else {
                         if ($char == '*') {
                             $lexer->pushOperator(new TokenMul());
                         } else {
                             if ($char == ')') {
                                 $lexer->closeParenthesis();
                             } else {
                                 if ($char == ',') {
                                     $lexer->incrementLastFunctionArity();
                                 } else {
                                     if ($char == '/') {
                                         $lexer->pushPath(new PathElementRoot());
                                     } else {
                                         if ($char == '.') {
                                             $lexer->setStateDot();
                                         } else {
                                             if (self::isBlank($char)) {
                                             } else {
                                                 $this->throwError($lexer, $char);
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
示例#2
0
 /**
  * @param Lexer $lexer
  * @param char $char
  */
 public function input(Lexer $lexer, $char)
 {
     if ($char == ')') {
         $lexer->pushOperator(new TokenFunction($this->buffer, 0));
         $lexer->closeParenthesis();
     } else {
         if ($char == '(') {
             $lexer->pushOperator(new TokenFunction($this->buffer, 1));
             $lexer->pushOperator(new TokenLParen());
         } else {
             if (self::isBlank($char)) {
             } else {
                 if ($char == "'") {
                     $lexer->pushOperator(new TokenFunction($this->buffer, 1));
                     $lexer->setStateString();
                 } else {
                     $lexer->pushOperator(new TokenFunction($this->buffer, 1));
                     $lexer->forwardInput($char);
                 }
             }
         }
     }
 }