/
lib
/
python3.9
/
site-packages
/
elftools
/
common
/
__pycache__
/
up file
home
a �#�_e � @ st d dl mZmZmZmZmZmZmZmZ G dd� de�Z dd� Z G dd� de�ZG dd � d e�Zd d� Z dd � ZdS )� )�Subconstruct�ConstructError� ArrayError�Adapter�Field�RepeatUntil�Rename�SizeofErrorc @ s6 e Zd ZdZdgZdd� Zdd� Zdd� Zd d � ZdS )�RepeatUntilExcludingz� A version of construct's RepeatUntil that doesn't include the last element (which casued the repeat to exit) in the return value. Only parsing is currently implemented. P.S. removed some code duplication � predicatec C s. t �| |� || _| �| j� | �| j� d S )N)r �__init__r Z_clear_flag�FLAG_COPY_CONTEXTZ _set_flagZFLAG_DYNAMIC)�selfr �subcon� r �C/usr/lib/python3.9/site-packages/elftools/common/construct_utils.pyr s zRepeatUntilExcluding.__init__c C s~ g }zF|}| j j| j@ r |�� }| j �||�}| �||�r<qH|�|� q W n. tyx } ztd|��W Y d }~n d }~0 0 |S )Nzmissing terminator) r Zconflagsr �__copy__�_parser �appendr r )r �stream�context�objZcontext_for_subconZsubobj�exr r r r s zRepeatUntilExcluding._parsec C s t d��d S )Nzno building)�NotImplementedError)r r r r r r r �_build, s zRepeatUntilExcluding._buildc C s t d��d S )Nzcan't calculate size)r )r r r r r �_sizeof. s zRepeatUntilExcluding._sizeofN) �__name__� __module__�__qualname__�__doc__� __slots__r r r r r r r r r s r c C s t dd� tdd��S )z{ Read LEB128 variable-length data from the stream. The data is terminated by a byte with 0 in its highest bit. c S s t | �dk S )N� )�ord)r �ctxr r r �<lambda>7 � z _LEB128_reader.<locals>.<lambda>N� )r r r r r r �_LEB128_reader2 s �r'