%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib64/python3.8/__pycache__/
Upload File :
Create Path :
Current File : //lib64/python3.8/__pycache__/shlex.cpython-38.pyc

U

e5d
4�	@s�dZddlZddlZddlZddlmZddlmZddddgZGd	d�d�Z	ddd�Z
d
d�Ze�dej
�jZdd�Zdd�Zedkr�eej�dkr�ee	��n,ejdZee��Zee	ee��W5QRXdS)�8A lexical analyzer class for simple shell-like syntaxes.�N)�deque)�StringIO�shlex�split�quote�joinc@sreZdZdZddd�Zedd��Zdd	�Zdd
d�Zdd
�Z	dd�Z
dd�Zdd�Zddd�Z
dd�Zdd�ZdS)rrNFcCst|t�rt|�}|dk	r(||_||_ntj|_d|_||_|rHd|_nd|_d|_	d|_
|jrn|j
d7_
d|_d|_d|_
d|_d	|_d
|_t�|_d|_d|_d|_t�|_d|_|s�d}n|d
kr�d}||_|�rt�|_|j
d7_
|j
�t�|��}|j
�|�|_
dS)N��#Z?abcdfeghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_u|ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞz 	
Fz'"�\�"� �rTz();<>|&z~-./*?=)�
isinstance�strr�instream�infile�sys�stdin�posix�eof�
commenters�	wordchars�
whitespace�whitespace_split�quotes�escape�
escapedquotes�stater�pushback�lineno�debug�token�	filestack�source�_punctuation_chars�_pushback_chars�	maketrans�dict�fromkeys�	translate)�selfrrr�punctuation_chars�t�r.�/usr/lib64/python3.8/shlex.py�__init__sJ
zshlex.__init__cCs|jS�N)r%�r+r.r.r/r,Dszshlex.punctuation_charscCs*|jdkrtdt|��|j�|�dS)z:Push a token onto the stack popped by the get_token methodrzshlex: pushing token N)r!�print�reprr�
appendleft)r+�tokr.r.r/�
push_tokenHs
zshlex.push_tokencCspt|t�rt|�}|j�|j|j|jf�||_||_d|_|jrl|dk	r\t	d|jf�nt	d|jf�dS)z9Push an input source onto the lexer's input source stack.rNzshlex: pushing to file %szshlex: pushing to stream %s)
rrrr#r5rrr r!r3)r+�	newstream�newfiler.r.r/�push_sourceNs
zshlex.push_sourcecCsD|j��|j��\|_|_|_|jr:td|j|jf�d|_dS)zPop the input source stack.zshlex: popping to %s, line %dr
N)	r�closer#�popleftrr r!r3rr2r.r.r/�
pop_source\s

�zshlex.pop_sourcecCs�|jr.|j��}|jdkr*tdt|��|S|��}|jdk	rz||jkrz|�|���}|rp|\}}|�||�|�	�}q@||j
kr�|js�|j
S|��|�	�}qz|jdkr�||j
kr�tdt|��ntd�|S)zBGet a token from the input stream (or from stack if it's nonempty)rzshlex: popping token Nz
shlex: token=zshlex: token=EOF)
rr<r!r3r4�
read_tokenr$�
sourcehookr:�	get_tokenrr#r=)r+r6�raw�specr9r8r.r.r/r@es.








zshlex.get_tokencCs�d}d}|jr |jr |j��}n|j�d�}|dkrB|jd7_|jdkr^td|j|f�|jdkrtd|_	�q�q|jdk�r�|s�d|_�q��q�||j
kr�|jdkr�td	�|j	s�|jr|r�q�nqn�||jkr�|j�
�|jd7_n�|j�r||jk�rd
}||_n�||jk�r&||_	d
|_nr||jk�r@||_	d|_nX||jk�rb|j�sZ||_	||_n6|j�rx||_	d
|_n ||_	|j	�s�|jr|r�q�nqq|j|jk�rDd}|�s�|jdk�r�td
�td��||jk�r|j�s�|j	|7_	d|_�q�nd
|_n>|j�r4||jk�r4|j|jk�r4|j}||_n|j	|7_	q|j|jk�r�|�st|jdk�rltd�td��||jk�r�||jk�r�||k�r�|j	|j7_	|j	|7_	||_q|jdkr|�s�d|_�q�q||j
k�r|jdk�r�td�d|_|j	�s�|jr|r�q�nqq||jk�rh|j�
�|jd7_|j�r�d|_|j	�s�|jr|r�q�nqq|jdk�r�||jk�r�|j	|7_	n"||j
k�r�|j�|�d|_�q�q|j�r�||jk�r�||_q|j�r�||jk�r�d
}||_q||jk�s||jk�s|j�r,||jk�r,|j	|7_	q|j�rB|j�|�n|j�|�|jdk�rbtd�d|_|j	�s�|jr|r�q�qqq|j	}d|_	|j�r�|�s�|dk�r�d}|jdk�r�|�r�tdt|��ntd�|S)NFr
r�
�z&shlex: in state %r I see character: %rr	�z+shlex: I see whitespace in whitespace state�a�cTz shlex: I see EOF in quotes statezNo closing quotationz shlex: I see EOF in escape statezNo escaped character)rFrGz%shlex: I see whitespace in word statez&shlex: I see punctuation in word statezshlex: raw token=zshlex: raw token=EOF)r,r&�popr�readr r!r3rr"rrr�readlinerrrr�
ValueErrorr�appendrr5r4)r+ZquotedZescapedstateZnextchar�resultr.r.r/r>�s

�




���

��zshlex.read_tokencCsV|ddkr|dd�}t|jt�rHtj�|�sHtj�tj�|j�|�}|t|d�fS)z(Hook called on a filename to be sourced.rrr����r)	rrr�os�path�isabsr�dirname�open)r+r9r.r.r/r?s
zshlex.sourcehookcCs(|dkr|j}|dkr|j}d||fS)z<Emit a C-compiler-like, Emacs-friendly error-message leader.Nz"%s", line %d: )rr )r+rr r.r.r/�error_leader s
zshlex.error_leadercCs|Sr1r.r2r.r.r/�__iter__(szshlex.__iter__cCs|��}||jkrt�|Sr1)r@r�
StopIteration)r+r"r.r.r/�__next__+s
zshlex.__next__)NNFF)N)NN)�__name__�
__module__�__qualname__�__doc__r0�propertyr,r7r:r=r@r>r?rUrVrXr.r.r.r/rs �
/

	 	
FTcCs$t||d�}d|_|sd|_t|�S)z-Split the string *s* using shell-like syntax.)rTr	)rrr�list)�sZcommentsrZlexr.r.r/r1s
cCsd�dd�|D��S)z3Return a shell-escaped string from *split_command*.r
css|]}t|�VqdSr1)r)�.0�argr.r.r/�	<genexpr><szjoin.<locals>.<genexpr>)r)Z
split_commandr.r.r/r:sz[^\w@%+=:,./-]cCs,|sdSt|�dkr|Sd|�dd�dS)z1Return a shell-escaped version of the string *s*.z''N�'z'"'"')�_find_unsafe�replace)r_r.r.r/rAs
cCs$|��}|sq tdt|��qdS)NzToken: )r@r3r4)ZlexerZttr.r.r/�
_print_tokensMsrf�__main__r)FT)r\rP�rer�collectionsr�ior�__all__rrr�compile�ASCII�searchrdrrfrY�len�argv�fnrT�fr.r.r.r/�<module>s(	 
	



Zerion Mini Shell 1.0