ok

Mini Shell

Direktori : /opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/__pycache__/shlex.cpython-35.opt-2.pyc



���]�,�@sddlZddlZddlZddlmZddlmZdddgZGdd�d�Zdd	d
d�Z	ej
dej�jZ
dd�Zd
d�Zedkreej�dkr�ee��n6ejdZee��Zeeee��WdQRXdS)�N)�deque)�StringIO�shlex�split�quotec@s�eZdZddddd�Zdd�Zddd�Zd	d
�Zdd�Zd
d�Zdd�Z	dddd�Z
dd�Zdd�ZdS)rNFcCst|t�rt|�}|dk	r<||_||_ntj|_d|_||_|rld|_n	d|_d|_	d|_
|jr�|j
d7_
d|_d|_d|_
d|_d	|_d
|_t�|_d|_d|_d|_t�|_d|_dS)
N��#Z?abcdfeghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_u|ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞz 	
Fz'"�\�"� �r)�
isinstance�strr�instream�infile�sys�stdin�posix�eof�
commenters�	wordchars�
whitespace�whitespace_split�quotes�escape�
escapedquotes�stater�pushback�lineno�debug�token�	filestack�source)�selfrrr�r$�*/opt/alt/python35/lib64/python3.5/shlex.py�__init__s6																zshlex.__init__cCs7|jdkr#tdt|��|jj|�dS)Nrzshlex: pushing token )r�print�reprr�
appendleft)r#�tokr$r$r%�
push_token5szshlex.push_tokencCs�t|t�rt|�}|jj|j|j|jf�||_||_d|_|jr�|dk	r�t	d|jf�nt	d|jf�dS)Nrzshlex: pushing to file %szshlex: pushing to stream %s)
r
rrr!r)rrrrr')r#�	newstream�newfiler$r$r%�push_source;s"				zshlex.push_sourcecCs^|jj�|jj�\|_|_|_|jrQtd|j|jf�d|_dS)Nzshlex: popping to %s, line %dr)	r�closer!�popleftrrrr'r)r#r$r$r%�
pop_sourceIs
!	zshlex.pop_sourcecCs2|jr?|jj�}|jdkr;tdt|��|S|j�}|jdk	r�xV||jkr�|j|j��}|r�|\}}|j||�|j	�}q]Wx9||j
kr�|js�|j
S|j�|j	�}q�W|jdkr.||j
kr$tdt|��n
td�|S)Nrzshlex: popping token z
shlex: token=zshlex: token=EOF)
rr0rr'r(�
read_tokenr"�
sourcehookr.�	get_tokenrr!r1)r#r*�raw�specr-r,r$r$r%r4Rs.		

zshlex.get_tokencCsud}d}x�|jjd�}|dkr=|jd|_|jdkrntdt|j�dt|��|jdkr�d|_Pq|jdkr�|s�d|_Pq||jkr�|jd	kr�td
�|js�|j	r|rPq�qq||j
kr%|jj�|jd|_q|j	rO||jkrOd}||_q||j
krs||_d|_q||jkr�|j	s�||_||_q|jr�||_d|_q||_|js�|j	r|rPqqq|j|jkr�d}|s,|jd	kr td
�td��||jkrm|j	sa|j||_d|_Pq�d|_q|j	r�||jkr�|j|jkr�|j}||_q|j||_q|j|jkrU|s�|jd	kr�td�td��||jkr9||jkr9||kr9|j|j|_|j||_||_q|jdkr|swd|_Pq||jkr�|jd	kr�td�d|_|js�|j	r|rPqqq||j
kr*|jj�|jd|_|j	rd|_|js |j	r|rPqqq|j	rN||jkrN||_q|j	rx||jkrxd}||_q||j
ks�||jks�|jr�|j||_q|jj|�|jd	kr�td�d|_|js�|j	r|rPqqqW|j}d|_|j	r;|r;|dkr;d}|jdkrq|rgtdt|��n
td�|S)NFrr�
�zshlex: in statezI see character:r�z+shlex: I see whitespace in whitespace state�aTz shlex: I see EOF in quotes statezNo closing quotationz shlex: I see EOF in escape statezNo escaped characterz%shlex: I see whitespace in word statez&shlex: I see punctuation in word statezshlex: raw token=zshlex: raw token=EOF)r�readrrr'r(rr rrr�readlinerrrr�
ValueErrorrrr))r#ZquotedZescapedstateZnextchar�resultr$r$r%r2rs�		

						
			
	
	
			
			
zshlex.read_tokencCs||ddkr |dd�}t|jt�ritjj|�ritjjtjj|j�|�}|t|d�fS)Nrr
r�r���)	r
rr�os�path�isabs�join�dirname�open)r#r-r$r$r%r3�s
%$zshlex.sourcehookcCs8|dkr|j}|dkr*|j}d||fS)Nz"%s", line %d: )rr)r#rrr$r$r%�error_leader�s
		zshlex.error_leadercCs|S)Nr$)r#r$r$r%�__iter__szshlex.__iter__cCs%|j�}||jkr!t�|S)N)r4r�
StopIteration)r#r r$r$r%�__next__szshlex.__next__)
�__name__�
__module__�__qualname__r&r+r.r1r4r2r3rGrHrJr$r$r$r%rs!	 �	FTcCs4t|d|�}d|_|s*d|_t|�S)NrTr)rrr�list)�sZcommentsrZlexr$r$r%rs
		z[^\w@%+=:,./-]cCs8|s
dSt|�dkr |Sd|jdd�dS)Nz''�'z'"'"')�_find_unsafe�replace)rOr$r$r%rs
cCs2x+|j�}|sPtdt|��qWdS)NzToken: )r4r'r()Zlexer�ttr$r$r%�
_print_tokens"s
rT�__main__r)rA�rer�collectionsr�ior�__all__rr�compile�ASCII�searchrQrrTrK�len�argv�fnrF�fr$r$r$r%�<module>	s �


Zerion Mini Shell 1.0