Your IP : 18.119.117.122


Current Path : /opt/alt/python310/lib64/python3.10/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/__pycache__/shlex.cpython-310.pyc

o

6��f�4�@s�dZddlZddlZddlZddlmZddlmZgd�ZGdd�d�Z	dd
d�Z
dd
�Ze�dej
�jZdd�Zdd�Zedkrseej�dkrPee	��dSejdZee��Zee	ee��Wd�dS1slwYdSdS)�8A lexical analyzer class for simple shell-like syntaxes.�N)�deque)�StringIO)�shlex�split�quote�joinc@sveZdZdZ		ddd�Zedd��Zdd	�Zdd
d�Zdd
�Z	dd�Z
dd�Zdd�Zddd�Z
dd�Zdd�ZdS)rrNFcCst|t�r	t|�}|dur||_||_ntj|_d|_||_|r$d|_nd|_d|_	d|_
|jr7|j
d7_
d|_d|_d|_
d|_d	|_d
|_t�|_d|_d|_d|_t�|_d|_|sbd}n|d
urhd}||_|r�t�|_|j
d7_
|j
�t�|��}|j
�|�|_
dSdS)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.�,/opt/alt/python310/lib64/python3.10/shlex.py�__init__sL
�zshlex.__init__cCs|jS�N)r%�r+r.r.r/r,Dszshlex.punctuation_charscCs*|jdkr
tdt|��|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_tokencCsvt|t�r	t|�}|j�|j|j|jf�||_||_d|_|jr9|dur/t	d|jf�dSt	d|jf�dSdS)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��\|_|_|_|jrtd|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��}|jdkrtdt|��|S|��}|jdurA||jkrA|�|���}|r8|\}}|�||�|�	�}||jks%||j
krY|jsL|j
S|��|�	�}||j
ksF|jdkrq||j
krmtdt|��|Std�|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@es4




�

�

�zshlex.get_tokencCs�d}d}	|jr|jr|j��}n|j�d�}|dkr"|jd7_|jdkr0td|j|f�|jdur:d|_	�n�|jdkr�|sFd|_�n�||j
vr_|jd	krTtd
�|j	s\|jr^|r^�n�q||jvrr|j�
�|jd7_�n�|jr�||jvr�d}||_�n�||jvr�||_	d|_�n�||jvr�||_	d|_�n�||jvr�|js�||_	||_�n�|jr�||_	d|_�n|||_	|j	s�|jr�|rÐnpq|j|jv�rd}|s�|jd	kr�td
�td��||jkr�|js�|j	|7_	d|_�nCd|_�n=|j�r||jv�r|j|jv�r|j}||_�n$|j	|7_	�n|j|jv�rS|�s/|jd	k�r+td�td��||jv�rH||jk�rH||k�rH|j	|j7_	|j	|7_	||_n�|jdv�r2|�s`d|_n�||j
v�r�|jd	k�rptd�d|_|j	�s~|j�r|�rn�q||jv�r�|j�
�|jd7_|j�r�d|_|j	�s�|j�r�|�r�n�qn�|jdk�r�||jv�r�|j	|7_	nw||j
v�r�|j�|�d|_nh|j�r�||jv�r�||_nY|j�r�||jv�r�d}||_nI||jv�s�||jv�s�|j�r||jv�r|j	|7_	n+|j�r|j�|�n|j�|�|jd	k�r"td�d|_|j	�s0|j�r1|�r1nqq|j	}d|_	|j�rG|�sG|dk�rGd}|jdk�r^|�rZtdt|��|Std�|S)NFr
Tr�
�z&shlex: in state %r I see character: %rr	�z+shlex: I see whitespace in whitespace state�a�cz 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�r$tj�|�s$tj�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(|dur|j}|dur|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__)NNFFr1)NN)�__name__�
__module__�__qualname__�__doc__r0�propertyr,r7r:r=r@r>r?rUrVrXr.r.r.r/rs"
�/

	 
	rFTcCsD|durddl}|jdtdd�t||d�}d|_|sd|_t|�S)	z-Split the string *s* using shell-like syntax.Nrz4Passing None for 's' to shlex.split() is deprecated.rE)�
stacklevel)rTr	)�warnings�warn�DeprecationWarningrrr�list)�sZcommentsrr_Zlexr.r.r/r1s�rcCsd�dd�|D��S)z3Return a shell-escaped string from *split_command*.r
css�|]}t|�VqdSr1)r)�.0�argr.r.r/�	<genexpr>@s�zjoin.<locals>.<genexpr>)r)Z
split_commandr.r.r/r>srz[^\w@%+=:,./-]cCs,|sdSt|�dur|Sd|�dd�dS)z1Return a shell-escaped version of the string *s*.z''N�'z'"'"')�_find_unsafe�replace)rcr.r.r/rEs
rcCs$	|��}|s	dStdt|��q)NrzToken: )r@r3r4)ZlexerZttr.r.r/�
_print_tokensQs�rj�__main__r)FT)r\rP�rer�collectionsr�ior�__all__rrr�compile�ASCII�searchrhrrjrY�len�argv�fnrT�fr.r.r.r/�<module>s.	
 


"��

?>