AlkantarClanX12

Your IP : 18.217.98.175


Current Path : /proc/self/root/opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python35/lib64/python3.5/__pycache__/shlex.cpython-35.opt-1.pyc



��Yf�,�@sdZddlZddlZddlZddlmZddlmZdddgZGdd�d�Z	d	d
dd�Z
ejdej�j
Zd
d�Zdd�Zedkreej�dkr�ee	��n6ejdZee��Zee	ee��WdQRXdS)z8A lexical analyzer class for simple shell-like syntaxes.�N)�deque)�StringIO�shlex�split�quotec@s�eZdZdZddddd�Zdd�Zddd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dddd�Zdd�Zdd�Z
dS)rz8A lexical analyzer class for simple shell-like syntaxes.NFcCst|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)z:Push a token onto the stack popped by the get_token methodrzshlex: pushing token N)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)z9Push an input source onto the lexer's input source stack.rNzshlex: 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)zPop the input source stack.zshlex: popping to %s, line %drN)	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)zBGet a token from the input stream (or from stack if it's nonempty)rzshlex: popping token Nz
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)z(Hook called on a filename to be sourced.rr
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)z<Emit a C-compiler-like, Emacs-friendly error-message leader.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__�__doc__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)z1Return a shell-escaped version of the string *s*.z''N�'z'"'"')�_find_unsafe�replace)rPr$r$r%rs
cCs2x+|j�}|sPtdt|��qWdS)NzToken: )r4r'r()ZlexerZttr$r$r%�
_print_tokens"s
rT�__main__r)rNrA�rer�collectionsr�ior�__all__rr�compile�ASCII�searchrRrrTrK�len�argv�fnrF�fr$r$r$r%�<module>s"�