639 if special == SPECIAL_NONE: |
639 if special == SPECIAL_NONE: |
640 self._decodedvalues.append(value) |
640 self._decodedvalues.append(value) |
641 |
641 |
642 elif special == SPECIAL_START_ARRAY: |
642 elif special == SPECIAL_START_ARRAY: |
643 self._collectionstack.append( |
643 self._collectionstack.append( |
644 {b'remaining': value, b'v': [],} |
644 { |
|
645 b'remaining': value, |
|
646 b'v': [], |
|
647 } |
645 ) |
648 ) |
646 self._state = self._STATE_WANT_ARRAY_VALUE |
649 self._state = self._STATE_WANT_ARRAY_VALUE |
647 |
650 |
648 elif special == SPECIAL_START_MAP: |
651 elif special == SPECIAL_START_MAP: |
649 self._collectionstack.append( |
652 self._collectionstack.append( |
650 {b'remaining': value, b'v': {},} |
653 { |
|
654 b'remaining': value, |
|
655 b'v': {}, |
|
656 } |
651 ) |
657 ) |
652 self._state = self._STATE_WANT_MAP_KEY |
658 self._state = self._STATE_WANT_MAP_KEY |
653 |
659 |
654 elif special == SPECIAL_START_SET: |
660 elif special == SPECIAL_START_SET: |
655 self._collectionstack.append( |
661 self._collectionstack.append( |
656 {b'remaining': value, b'v': set(),} |
662 { |
|
663 b'remaining': value, |
|
664 b'v': set(), |
|
665 } |
657 ) |
666 ) |
658 self._state = self._STATE_WANT_SET_VALUE |
667 self._state = self._STATE_WANT_SET_VALUE |
659 |
668 |
660 elif special == SPECIAL_START_INDEFINITE_BYTESTRING: |
669 elif special == SPECIAL_START_INDEFINITE_BYTESTRING: |
661 self._state = self._STATE_WANT_BYTESTRING_CHUNK_FIRST |
670 self._state = self._STATE_WANT_BYTESTRING_CHUNK_FIRST |
682 |
691 |
683 lastc[b'v'].append(newvalue) |
692 lastc[b'v'].append(newvalue) |
684 lastc[b'remaining'] -= 1 |
693 lastc[b'remaining'] -= 1 |
685 |
694 |
686 self._collectionstack.append( |
695 self._collectionstack.append( |
687 {b'remaining': value, b'v': newvalue,} |
696 { |
|
697 b'remaining': value, |
|
698 b'v': newvalue, |
|
699 } |
688 ) |
700 ) |
689 |
701 |
690 # self._state doesn't need changed. |
702 # self._state doesn't need changed. |
691 |
703 |
692 # A map nested within an array. |
704 # A map nested within an array. |
709 |
721 |
710 lastc[b'v'].append(newvalue) |
722 lastc[b'v'].append(newvalue) |
711 lastc[b'remaining'] -= 1 |
723 lastc[b'remaining'] -= 1 |
712 |
724 |
713 self._collectionstack.append( |
725 self._collectionstack.append( |
714 {b'remaining': value, b'v': newvalue,} |
726 { |
|
727 b'remaining': value, |
|
728 b'v': newvalue, |
|
729 } |
715 ) |
730 ) |
716 |
731 |
717 self._state = self._STATE_WANT_SET_VALUE |
732 self._state = self._STATE_WANT_SET_VALUE |
718 |
733 |
719 elif special == SPECIAL_START_INDEFINITE_BYTESTRING: |
734 elif special == SPECIAL_START_INDEFINITE_BYTESTRING: |
773 |
788 |
774 lastc[b'v'][self._currentmapkey] = newvalue |
789 lastc[b'v'][self._currentmapkey] = newvalue |
775 lastc[b'remaining'] -= 1 |
790 lastc[b'remaining'] -= 1 |
776 |
791 |
777 self._collectionstack.append( |
792 self._collectionstack.append( |
778 {b'remaining': value, b'v': newvalue,} |
793 { |
|
794 b'remaining': value, |
|
795 b'v': newvalue, |
|
796 } |
779 ) |
797 ) |
780 |
798 |
781 self._state = self._STATE_WANT_ARRAY_VALUE |
799 self._state = self._STATE_WANT_ARRAY_VALUE |
782 |
800 |
783 # A new map is used as the map value. |
801 # A new map is used as the map value. |
787 |
805 |
788 lastc[b'v'][self._currentmapkey] = newvalue |
806 lastc[b'v'][self._currentmapkey] = newvalue |
789 lastc[b'remaining'] -= 1 |
807 lastc[b'remaining'] -= 1 |
790 |
808 |
791 self._collectionstack.append( |
809 self._collectionstack.append( |
792 {b'remaining': value, b'v': newvalue,} |
810 { |
|
811 b'remaining': value, |
|
812 b'v': newvalue, |
|
813 } |
793 ) |
814 ) |
794 |
815 |
795 self._state = self._STATE_WANT_MAP_KEY |
816 self._state = self._STATE_WANT_MAP_KEY |
796 |
817 |
797 # A new set is used as the map value. |
818 # A new set is used as the map value. |
801 |
822 |
802 lastc[b'v'][self._currentmapkey] = newvalue |
823 lastc[b'v'][self._currentmapkey] = newvalue |
803 lastc[b'remaining'] -= 1 |
824 lastc[b'remaining'] -= 1 |
804 |
825 |
805 self._collectionstack.append( |
826 self._collectionstack.append( |
806 {b'remaining': value, b'v': newvalue,} |
827 { |
|
828 b'remaining': value, |
|
829 b'v': newvalue, |
|
830 } |
807 ) |
831 ) |
808 |
832 |
809 self._state = self._STATE_WANT_SET_VALUE |
833 self._state = self._STATE_WANT_SET_VALUE |
810 |
834 |
811 elif special == SPECIAL_START_INDEFINITE_BYTESTRING: |
835 elif special == SPECIAL_START_INDEFINITE_BYTESTRING: |