src/Peach/DF/JsonCodec/Number.php
private function handleIntegralPart(Context $context)
    {
        // check zero
        if ($context->current() === "0") {
            if (preg_match("/^0[0-9]$/", $context->getSequence(2))) {
                throw $context->createException("Integral part must not start with 0");
            }
            $this->result .= "0";
            $context->next();
            return;
        }
        
        // check ( digit1-9 *DIGIT )
        $this->handleFirstDigit($context);
        $this->handleDigitSequence($context);
    }
private function handleIntegralPart(Context $context)
    {
        // check zero
        if ($context->current() === "0") {
            if (preg_match("/^0[0-9]$/", $context->getSequence(2))) {
                throw $context->createException("Integral part must not start with 0");
            }
            $this->result .= "0";
            $context->next();
            return;
        }
        
        // check ( digit1-9 *DIGIT )
        $this->handleFirstDigit($context);
        $this->handleDigitSequence($context);
    }
数値部分 (以下の BNF 記法) を読み込みます.

int = zero / ( digit1-9 *DIGIT )

@param Context $context