src/Peach/DF/JsonCodec/StringExpr.php
public function handle(Context $context)
    {
        $quot = $context->current();
        if ($quot !== '"') {
            throw $context->createException("A string must be quoted by '\"'");
        }
        $context->next();
        $value = "";
        $escaped = false;
        while ($context->hasNext()) {
            if ($escaped) {
                $value .= $this->decodeEscapedChar($context);
                $escaped = false;
                continue;
            }
            
            $this->validateCodePoint($context);
            $current = $context->current();
            $context->next();
            switch ($current) {
                case '"':
                    $this->result = $value;
                    return;
                case "\\":
                    $escaped = true;
                    break;
                default:
                    $value .= $current;
                    break;
            }
        }
        
        throw $context->createException("End of quotation mark not found");
    }
public function handle(Context $context)
    {
        $quot = $context->current();
        if ($quot !== '"') {
            throw $context->createException("A string must be quoted by '\"'");
        }
        $context->next();
        $value = "";
        $escaped = false;
        while ($context->hasNext()) {
            if ($escaped) {
                $value .= $this->decodeEscapedChar($context);
                $escaped = false;
                continue;
            }
            
            $this->validateCodePoint($context);
            $current = $context->current();
            $context->next();
            switch ($current) {
                case '"':
                    $this->result = $value;
                    return;
                case "\\":
                    $escaped = true;
                    break;
                default:
                    $value .= $current;
                    break;
            }
        }
        
        throw $context->createException("End of quotation mark not found");
    }
二重引用符で囲まれた JSON 文字列を解析し, 対応する文字列に変換します.

@param Context $context 処理対象の Context オブジェクト