AlkantarClanX12

Your IP : 3.135.214.139


Current Path : /opt/alt/python34/lib64/python3.4/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/__pycache__/shlex.cpython-34.pyc

�
j f-�@sdZddlZddlZddlZddlmZddlmZdddgZGdd�d�Z	d	d
dd�Z
ejdej�j
Zd
d�Zdd�Zedkreej�dkr�ee	��qejdZee��Zee	ee��WdQXndS)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.NFcCsAt|t�rt|�}n|dk	r?||_||_ntj|_d|_||_|rod|_n	d|_d|_	d|_
|jr�|j
d7_
nd|_d|_d|_
d|_d	|_d
|_t�|_d|_d|_d|_t�|_d|_|jr=td
|j|jf�ndS)N��#Z?abcdfeghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_u|ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞz 	
Fz'"�\�"� �rzshlex: reading from %s, line %d)�
isinstance�strr�instream�infile�sys�stdin�posix�eof�
commenters�	wordchars�
whitespace�whitespace_split�quotes�escape�
escapedquotes�stater�pushback�lineno�debug�token�	filestack�source�print)�selfrrr�r%�*/opt/alt/python34/lib64/python3.4/shlex.py�__init__s<																		zshlex.__init__cCs:|jdkr&tdt|��n|jj|�dS)z:Push a token onto the stack popped by the get_token methodrzshlex: pushing token N)rr#�reprr�
appendleft)r$�tokr%r%r&�
push_token8szshlex.push_tokencCs�t|t�rt|�}n|jj|j|j|jf�||_||_d|_|jr�|dk	r�t	d|jf�q�t	d|jf�ndS)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_sourcecCsa|jj�|jj�\|_|_|_|jrTtd|j|jf�nd|_dS)zPop the input source stack.zshlex: popping to %s, line %drN)	r�closer!�popleftrrrr#r)r$r%r%r&�
pop_sourceLs
!	zshlex.pop_sourcecCs>|jrB|jj�}|jdkr>tdt|��n|S|j�}|jdk	r�x\||jkr�|j|j��}|r�|\}}|j||�n|j	�}q`Wnx9||j
kr�|js�|j
S|j�|j	�}q�W|jdkr:||j
kr-tdt|��q:td�n|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&r4Us.		

zshlex.get_tokencCs�d}d}x|jjd�}|dkr@|jd|_n|jdkrttdt|j�dt|��n|jdkr�d|_Pq|jdkr�|s�d|_Pq||jkr�|jd	kr�td
�n|js�|j	r|rPq�qq||j
kr.|jj�|jd|_q|j	rX||jkrXd}||_q||j
kr|||_d|_q||jkr�|j	s�||_n||_q|jr�||_d|_q||_|js�|j	r|rPqqq|j|jkr�d}|s>|jd	kr/td
�ntd��n||jkr|j	ss|j||_d|_Pq�d|_q|j	r�||jkr�|j|jkr�|j}||_q|j||_q|j|jkrp|s|jd	krtd�ntd��n||jkrT||jkrT||krT|j|j|_n|j||_||_q|jdkr|s�d|_Pq||jkr�|jd	kr�td�nd|_|js�|j	r|rPqqq||j
krK|jj�|jd|_|j	rd|_|js>|j	r|rPqHqqq|j	ro||jkro||_q|j	r�||jkr�d}||_q||j
ks�||jks�|jr�|j||_q|jj|�|jd	kr�td�nd|_|jrPqqqqW|j}d|_|j	rV|rV|dkrVd}n|jdkr�|r�tdt|��q�td�n|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&r2us�		

					
			
	
	
				
		
			
zshlex.read_tokencCs�|ddkr#|dd�}nt|jt�rotjj|�rotjjtjj|j�|�}n|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.sourcehookcCs>|dkr|j}n|dkr0|j}nd||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�n|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$	 �	FTcCs7t|d|�}d|_|s-d|_nt|�S)NrTr)rrr�list)�sZcommentsrZlexr%r%r&rs
	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
cCs5x.|j�}|sPntdt|��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"�