Exemplo n.º 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);
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }