예제 #1
0
파일: Number.php 프로젝트: trashtoy/peach2
 /**
  * exp = e [ minus / plus ] 1*DIGIT
  * 
  * @param Context $context
  */
 private function handleExponentPart(Context $context)
 {
     // e = %x65 / %x45
     $current = $context->current();
     if ($current !== "e" && $current !== "E") {
         return;
     }
     $this->result .= "e";
     $this->isFloat = true;
     $next = $context->next();
     // [ minus / plus ]
     if ($next === "+" || $next === "-") {
         $this->result .= $next;
         $context->next();
     }
     // 1*DIGIT
     $this->handleFirstDigit($context);
     $this->handleDigitSequence($context);
 }
예제 #2
0
 /**
  * @covers Peach\DF\JsonCodec\Context::next
  * @expectedException Peach\DF\JsonCodec\DecodeException
  */
 public function testNextFail()
 {
     $context = new Context("This is a pen.", new ArrayMap());
     for ($i = 0; $i < 14; $i++) {
         $context->next();
     }
     $this->assertFalse($context->hasNext());
     $context->next();
 }