コード例 #1
0
ファイル: DFAStateString.php プロジェクト: tboloo/figdice
 /**
  * @param Lexer $lexer
  * @param char $char
  */
 public function input(Lexer $lexer, $char)
 {
     if ($this->escaping) {
         $this->buffer .= $char;
         $this->escaping = false;
     } else {
         if ($char == "'") {
             $lexer->pushOperand(new TokenLiteral($this->buffer));
             $this->closed = true;
         } else {
             if ($char == '\\') {
                 $this->escaping = true;
             } else {
                 if ($this->closed) {
                     if ($char == ',') {
                         $lexer->incrementLastFunctionArity();
                         $lexer->setStateEmpty();
                     } else {
                         if ($char == ')') {
                             $lexer->closeParenthesis();
                         } else {
                             if (self::isBlank($char)) {
                             } else {
                                 if ($char == '+' || $char == '-') {
                                     $lexer->pushOperator(new TokenPlusMinus($char));
                                 } else {
                                     if ($char == '=' || $char == '!') {
                                         $lexer->setStateComparison($char);
                                     } else {
                                         if ($char == '*') {
                                             $lexer->pushOperator(new TokenMul());
                                         } else {
                                             if ($char == ']') {
                                                 $lexer->closeSquareBracket();
                                             } else {
                                                 $this->throwError($lexer, $char);
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 } else {
                     $this->buffer .= $char;
                 }
             }
         }
     }
 }