Hacked By AnonymousFox

Current Path : /lib/python3.6/site-packages/ply/__pycache__/
Upload File :
Current File : //lib/python3.6/site-packages/ply/__pycache__/lex.cpython-36.pyc

3

r��W�@s"dZdZddlZddlZddlZddlZddlZddlZyejej	fZ
Wnek
rdee
fZ
YnXejd�ZGdd�de�ZGdd�de�ZGd	d
�d
e�ZGdd�de�ZGd
d�d�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�ZGdd�de�Zd%dd �Zd&d!d"�Zd#d$�Z e Z!dS)'z3.9z3.8�Nz^[a-zA-Z0-9_]+$c@seZdZdd�ZdS)�LexErrorcCs|f|_||_dS)N)�args�text)�self�message�s�r�/usr/lib/python3.6/lex.py�__init__:szLexError.__init__N)�__name__�
__module__�__qualname__r
rrrr	r9src@seZdZdd�Zdd�ZdS)�LexTokencCsd|j|j|j|jfS)NzLexToken(%s,%r,%d,%d))�type�value�lineno�lexpos)rrrr	�__str__AszLexToken.__str__cCst|�S)N)�str)rrrr	�__repr__DszLexToken.__repr__N)rrr
rrrrrr	r@src@s4eZdZdd�Zdd�Zdd�Zdd�ZeZeZd	S)
�	PlyLoggercCs
||_dS)N)�f)rrrrr	r
LszPlyLogger.__init__cOs|jj||d�dS)N�
)r�write)r�msgr�kwargsrrr	�criticalOszPlyLogger.criticalcOs|jjd||d�dS)Nz	WARNING: r)rr)rrrrrrr	�warningRszPlyLogger.warningcOs|jjd||d�dS)NzERROR: r)rr)rrrrrrr	�errorUszPlyLogger.errorN)	rrr
r
rrr�info�debugrrrr	rKsrc@seZdZdd�Zdd�ZdS)�
NullLoggercCs|S)Nr)r�namerrr	�__getattribute__^szNullLogger.__getattribute__cOs|S)Nr)rrrrrr	�__call__aszNullLogger.__call__N)rrr
r#r$rrrr	r!]sr!c@s|eZdZdd�Zddd�Zddd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZeZdS)�LexercCs�d|_d|_i|_i|_i|_d|_g|_d|_i|_i|_	i|_
d|_d|_d|_
d|_d|_d|_d|_d|_d|_d|_d|_d|_dS)N�INITIALr��F)�lexre�	lexretext�
lexstatere�lexstateretext�lexstaterenames�lexstate�
lexstatestack�lexstateinfo�lexstateignore�lexstateerrorf�lexstateeoff�
lexreflags�lexdatar�lexlen�	lexerrorf�lexeoff�	lextokens�	lexignore�lexliterals�	lexmoduler�lexoptimize)rrrr	r
ts.zLexer.__init__NcCs�tj|�}|r�i}x�|jj�D]�\}}g}x\|D]T\}}g}	xF|D]>}
|
sV|
drb|	j|
�qB|	jt||
dj�|
df�qBWq0W|j||	f�|||<qW||_i|_x(|jj�D]\}}t||j�|j|<q�W||_|S)Nrr()�copyr+�items�append�getattrrr2r<)r�object�cZnewtab�keyZritemZnewreZcreZfindexZ	newfindexr�efrrr	�clone�s(


&zLexer.cloner'cCs�t|tj�rtd��|jd�d}tjj||�d}t|d����}|j	d|t
f�|j	dtt��|j	dtt
|j���|j	d	t|j��|j	d
t|j��|j	dt|j��i}xb|jj�D]T\}}g}	x>t||j||j|�D]"\\}
}}}
|	j|t||
�f�q�W|	||<q�W|j	dt|��|j	d
t|j��i}x,|jj�D]\}}|�rl|jnd||<�qXW|j	dt|��i}x,|jj�D]\}}|�r�|jnd||<�q�W|j	dt|��WdQRXdS)Nz&Won't overwrite existing lextab module�.r(z.py�wzJ# %s.py. This file automatically created by PLY (version %s). Don't edit!
z_tabversion   = %s
z_lextokens    = set(%s)
z_lexreflags   = %s
z_lexliterals  = %s
z_lexstateinfo = %s
z_lexstatere   = %s
z_lexstateignore = %s
z_lexstateerrorf = %s
z_lexstateeoff = %s
���)�
isinstance�types�
ModuleType�IOError�split�os�path�join�openr�__version__�repr�__tabversion__�tupler9r4r;r0r+r?�zipr,r-r@�_funcs_to_namesr1r2rr3)r�lextab�	outputdirZ
basetabmodule�filenameZtfZtabre�	statename�lre�titem�pat�funcZretext�renamesZtaberrrEZtabeofrrr	�writetab�s6(zLexer.writetabcCsZt|tj�r|}ntd|�tj|}t|dd�tkr@td��|j	|_
|j|_|j
|_|j
t|j�B|_|j|_|j|_i|_i|_xh|jj�D]Z\}}g}g}x4|D],\}}	|jtj||jtjB�t|	|�f�q�W||j|<||j|<q�Wi|_x&|jj�D]\}}
||
|j|<�qWi|_ x&|j!j�D]\}}
||
|j |<�q0W|j"d�dS)Nz	import %sZ_tabversionz0.0zInconsistent PLY versionr&)#rJrKrL�exec�sys�modulesrArU�ImportErrorZ
_lextokensr9Z_lexreflagsr4Z_lexliteralsr;�set�
lextokens_allZ
_lexstateinfor0Z_lexstateignorer1r+r,Z_lexstaterer?r@�re�compile�VERBOSE�_names_to_funcsr2Z_lexstateerrorfr3Z
_lexstateeoff�begin)rZtabfile�fdictrYr\r]r^Ztxtitemr_Z	func_namerErrr	�readtab�s8
(
z
Lexer.readtabcCs8|dd�}t|t�std��||_d|_t|�|_dS)Nr(zExpected a stringr)rJ�StringTypes�
ValueErrorr5r�lenr6)rrrCrrr	�input�s
zLexer.inputcCsd||jkrtd��|j||_|j||_|jj|d�|_|jj|d�|_	|j
j|d�|_||_dS)NzUndefined stater')
r+rqr)r,r*r1�getr:r2r7r3r8r.)r�staterrr	rms
zLexer.begincCs|jj|j�|j|�dS)N)r/r@r.rm)rrurrr	�
push_stateszLexer.push_statecCs|j|jj��dS)N)rmr/�pop)rrrr	�	pop_stateszLexer.pop_statecCs|jS)N)r.)rrrr	�
current_state!szLexer.current_statecCs|j|7_dS)N)r)r�nrrr	�skip'sz
Lexer.skipcCs~|j}|j}|j}|j}�x�||k�r|||kr<|d7}q�x�|jD]�\}}|j||�}|s`qFt�}|j�|_|j	|_	||_|j
}	||	\}
|_|
s�|jr�|j�|_|S|j�}P|j�}||_
||_||_|
|�}|s�|j}|j}P|j�s(|j|jk�r(td|
jj|
jj|
j|jf||d���|SW|||jk�rrt�}|||_|j	|_	|j|_||_|d|_|S|j�r�t�}|j|d�|_|j	|_	d|_||_
||_||_|j|�}||jk�r�td||||d���|j}|�s�q|S||_td|||f||d���qW|j�r\t�}d|_d|_|j	|_	||_||_
||_|j|�}|S|d|_|jdk�rztd��dS)	Nr(z4%s:%d: Rule '%s' returned an unknown token type '%s'rz&Scanning error. Illegal character '%s'z"Illegal character '%s' at index %d�eofr'z"No input string given with input())rr6r:r5r)�matchr�grouprr�	lastindexr�end�lexerZlexmatchr=rhr�__code__�co_filename�co_firstlinenorr;r7r8�RuntimeError)rrr6r:r5r)�lexindexfunc�m�tok�ir`Znewtokrrr	�token1s�




"

zLexer.tokencCs|S)Nr)rrrr	�__iter__�szLexer.__iter__cCs|j�}|dkrt�|S)N)r��
StopIteration)r�trrr	�next�sz
Lexer.next)N)r')rrr
r
rFrbrorsrmrvrxryr{r�r�r��__next__rrrr	r%ss

%(

nr%cCst|d|j�S)N�regex)rA�__doc__)r`rrr	�
_get_regex�sr�cCs0tj|�}|jj�}|j|jkr,|j|j�|S)N)rd�	_getframe�	f_globalsr>�f_locals�update)Zlevelsr�ldictrrr	�get_caller_module_dict�s


r�cCsJg}x@t||�D]2\}}|r8|dr8|j||df�q|j|�qW|S)Nrr()rWr@)Zfunclist�namelist�resultrr"rrr	rX�srXcCsHg}x>|D]6}|r6|dr6|j||d|df�q
|j|�q
W|S)Nrr()r@)r�rnr�rzrrr	rl�s
rlcCsj|sgSdj|�}y�tj|tj|B�}dgt|jj��d}|dd�}x�|jj�D]z\}}	|j|d�}
t	|
�t
jt
jfkr�|
||f||	<|||	<qV|
dk	rV|||	<|j
d�dkr�d||	<qVd||f||	<qVW||fg|g|gfStk
�rdtt|�d�}|dk�rd}t|d|�|||�\}}
}t||d�|||�\}}}|||
|||fSXdS)N�|r(�ignore_r�)NN)rQrirjrk�max�
groupindex�valuesr?rtrrK�FunctionType�
MethodType�find�	Exception�intrr�_form_master_re)Zrelist�reflagsr��toknamesr�r)r�Z
lexindexnamesrr�Zhandler�Zllistr]ZlnamesZrlistZrreZrnamesrrr	r��s2



r�cCs�d}|jd�}x0t|dd�d�D]\}}||kr"|dkr"Pq"W|dkrZt|d|��}nd}d|krnt|�}dj||d��}||fS)Nr(�_�ANYr&)r&)rN�	enumeraterVrQ)r�namesZnonstate�partsr��part�statesZ	tokennamerrr	�_statetokens
r�c@sfeZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�LexerReflectNrcCsL||_d|_g|_||_ddi|_t�|_d|_|dkrBtt	j
�n||_dS)Nr&�	inclusiveF)r�Z
error_func�tokensr��	stateinforgrerrrd�stderr�log)rr�r�r�rrr	r
/s
zLexerReflect.__init__cCs$|j�|j�|j�|j�dS)N)�
get_tokens�get_literals�
get_states�	get_rules)rrrr	�get_all:szLexerReflect.get_allcCs|j�|j�|j�|jS)N)�validate_tokens�validate_literals�validate_rulesr)rrrr	�validate_allAszLexerReflect.validate_allcCsp|jjdd�}|s(|jjd�d|_dSt|ttf�sL|jjd�d|_dS|sf|jjd�d|_dS||_dS)Nr�zNo token list is definedTztokens must be a list or tupleztokens is empty)r�rtr�rrJ�listrVr�)rr�rrr	r�HszLexerReflect.get_tokenscCsTi}xJ|jD]@}tj|�s.|jjd|�d|_||krD|jjd|�d||<qWdS)NzBad token name '%s'TzToken '%s' multiply definedr()r��_is_identifierr}r�rr)rZ	terminalsrzrrr	r�\s
zLexerReflect.validate_tokenscCs |jjdd�|_|jsd|_dS)N�literalsr')r�rtr�)rrrr	r�gszLexerReflect.get_literalscCspyDx>|jD]4}t|t�s&t|�dkr
|jjdt|��d|_q
WWn&tk
rj|jjd�d|_YnXdS)Nr(z.Invalid literal %s. Must be a single characterTzIInvalid literals specification. literals must be a sequence of characters)r�rJrprrr�rrT�	TypeError)rrCrrr	r�mszLexerReflect.validate_literalscCs�|jjdd�|_|jr�t|jttf�s:|jjd�d|_n�x�|jD]�}t|t�s^t|�dkrx|jjdt	|��d|_qB|\}}t|t
�s�|jjdt	|��d|_qB|dkp�|dks�|jjd	|�d|_qB||jkr�|jjd
|�d|_qB||j|<qBWdS)Nr�z)states must be defined as a tuple or listTr�zMInvalid state specifier %s. Must be a tuple (statename,'exclusive|inclusive')zState name %s must be a stringr��	exclusivez:State type for state %s must be 'inclusive' or 'exclusive'zState '%s' already defined)r�rtr�rJrVr�r�rrrrTrpr�)rrr"Z	statetyperrr	r�xs0

zLexerReflect.get_statesc	CsRdd�|jD�}i|_i|_i|_i|_i|_i|_x"|jD]}g|j|<g|j|<q<Wt|�dkrz|j	j
d�d|_
dS�x�|D�]x}|j|}t||j�\}}||j|<t|d��rX|dkr�x�|D]}||j|<q�Wn||dkr�xr|D]}||j|<q�WnZ|d	k�r2|j
j}|j
j}|j	j
d
|||j�d|_
n$x�|D]}|j|j||f��q8Wq�t|t��r�|d	k�r�x|D]}||j|<�qtWd|k�r�|j	jd|�nD|dk�r�|j	j
d
|�d|_
n$x8|D]}|j|j||f��q�Wq�|j	j
d|�d|_
q�Wx$|jj�D]}|jdd�d��qWx&|jj�D]}|jdd�dd��q2WdS)NcSs g|]}|dd�dkr|�qS)Nr�Zt_r)�.0rrrr	�
<listcomp>�sz*LexerReflect.get_rules.<locals>.<listcomp>rz+No rules of the form t_rulename are definedTr$rr|�ignorez,%s:%d: Rule '%s' must be defined as a string�\z#%s contains a literal backslash '\'z'Rule '%s' must be defined as a functionz&%s not defined as a function or stringcSs|djjS)Nr()r�r�)�xrrr	�<lambda>�sz(LexerReflect.get_rules.<locals>.<lambda>)rDcSst|d�S)Nr()rr)r�rrr	r��s)rD�reverse)r�r��funcsym�strsymr��errorf�eoffr�rrr�rr��hasattrr�r�r�rr@rJrprr��sort)	rZtsymbolsrrr�r��tokname�line�filerrr	r��sb












zLexerReflect.get_rulescCs��x~|jD�]r}�x�|j|D�]r\}}|jj}|jj}tj|�}|jj|�|j	|}t
|tj�rjd}nd}|jj
}	|	|kr�|jjd|||j�d|_q|	|kr�|jjd|||j�d|_qt|�s�|jjd|||j�d|_qyJtjd|t|�ftj|jB�}
|
jd��r*|jjd	|||j�d|_Wqtjk
�r�}zD|jjd
|||j|�dt|�k�rz|jjd|||j�d|_WYdd}~XqXqW�x|j|D�]\}}
|j	|}|d
k�r�|jjd|�d|_�q�||jk�r|jd�dk�r|jjd||�d|_�q�y@tjd||
ftj|jB�}
|
jd��rN|jjd|�d|_WnTtjk
�r�}z4|jjd||�d|
k�r�|jjd|�d|_WYdd}~XnX�q�W|j|�r�|j|�r�|jjd|�d|_|jj|d�}|r
|}|jj}|jj}tj|�}|jj|�t
|tj��r,d}nd}|jj
}	|	|k�r\|jjd|||j�d|_|	|kr
|jjd|||j�d|_q
Wx|jD]}|j|��q�WdS)Nr�r(z'%s:%d: Rule '%s' has too many argumentsTz%%s:%d: Rule '%s' requires an argumentz2%s:%d: No regular expression defined for rule '%s'z
(?P<%s>%s)r'z<%s:%d: Regular expression for rule '%s' matches empty stringz3%s:%d: Invalid regular expression for rule '%s'. %s�#z6%s:%d. Make sure '#' in rule '%s' is escaped with '\#'rz'Rule '%s' must be defined as a functionr�rz-Rule '%s' defined for an unspecified token %sz5Regular expression for rule '%s' matches empty stringz,Invalid regular expression for rule '%s'. %sz/Make sure '#' in rule '%s' is escaped with '\#'zNo rules defined for state '%s')r�r�r�r�r��inspectZ	getmodulere�addr�rJrKr��co_argcountr�rrr�rirjrkr�r}r�r�r�r�rt�validate_module)rru�fnamerr�r��moduler�Zreqargs�nargsrC�er"�rZefuncrrr	r��s�

 







zLexerReflect.validate_rulescCs�ytj|�\}}Wntk
r&dSXtjd�}tjd�}i}|d7}xv|D]n}|j|�}|sj|j|�}|r�|jd�}	|j|	�}
|
s�|||	<n$tj|�}|j	j
d|||	|
�d|_
|d7}qNWdS)Nz\s*def\s+(t_[a-zA-Z_0-9]*)\(z\s*(t_[a-zA-Z_0-9]*)\s*=r(z7%s:%d: Rule %s redefined. Previously defined on line %dT)r�ZgetsourcelinesrMrirjr}r~rtZ
getsourcefiler�r)rr��linesZlinenZfreZsreZ	counthashr�r�r"�prevr[rrr	r�@s*








zLexerReflect.validate_module)Nr)rrr
r
r�r�r�r�r�r�r�r�r�r�rrrr	r�.s
Bgr�FrYc
%s�|dkrd}d}
ddi}t�}||_|	dkr6ttj�}	|rL|dkrLttj�}|rT|��r��fdd�t��D�}
t|
�}
d|
kr�tj|
dj|
d<nt	d�}
|
j
d	�}|r�t|t�r�d
|kr�|d
|}t
|
|	|d�}|j�|s�|j�r�td��|o�|�r4y |j||
�|ja|ja|a|Stk
�r2YnX|�rd|jd
|j�|jd|j�|jd|j�t�|_x|jD]}|jj|��qtWt|jttf��r�t|jd��j |j�|_!n|j|_!|jt|j!�B|_"|j}i}x�|D]�}g}xX|j#|D]J\}}|j$j%}|j$j&}|j'd|t(|�f�|�r�|jd|t(|�|��q�Wx@|j)|D]2\}}|j'd||f�|�rP|jd|||��qPW|||<�q�W|�r�|jd�xt|D]l}t*||||
|j+�\}}}||j,|<||j-|<||j.|<|�r�x&t/|�D]\}}|jd|||��q�W�q�Wxl|j0�D]`\}}|dk�r$|dk�r$|j,|j1|j,d�|j-|j1|j-d�|j.|j1|j.d��q$W||_2|j,d|_3|j-d|_4||_5|j6|_7|j7j
dd�|_8|j9|_:|j9j
dd�|_;|j;�s�|	j<d�|j=|_>|j=j
dd�|_?x�|j0�D]�\} }|dk�r\| |j9k�r:|	j<d| �| |j6k�r�|j8�r�|	j<d| �nJ|dk�r| |j9k�r�|j9j
dd�|j9| <| |j6k�r|j6j
dd�|j6| <�qW|ja|ja|a|�r�|�r�|dk�rBt|t@jA��r�|j}!nNd
|k�r�|
d}!n:|jBd
�}"d
j |"dd��}#tCd|#�tDtj|#dd�}!tEjFjG|!�}y|jH||�Wn6tIk
�r�}$z|	j<d||$f�WYdd}$~$XnX|S)NrYr&r�csg|]}|t�|�f�qSr)rA)r��k)r�rr	r�zszlex.<locals>.<listcomp>�__file__rr��__package__rG)r�r�zCan't build lexerzlex: tokens   = %rzlex: literals = %rzlex: states   = %rrz
(?P<%s>%s)z(lex: Adding rule %s -> '%s' (state '%s')z#lex: ==== MASTER REGEXS FOLLOW ====z"lex: state '%s' : regex[%d] = '%s'r'zNo t_error rule is definedr�z1No error rule is defined for exclusive state '%s'z2No ignore rule is defined for exclusive state '%s'r(z	import %sz#Couldn't write lextab module %r. %srI)Jr%r=rrdr��dir�dictrer�r�rtrJrr�r�r��SyntaxErrorror�rsr�rfrr�r�r�rgr9r�r�rVrrQr;rhr�r�r�r�r@r�r�r�r�r+r,r-r�r?�extendr0r)r*r4r�r1r:r�r2r7rr�r3r8rKrLrNrcrArOrP�dirnamerbrM)%r�rBr �optimizerYr�ZnowarnrZZdebuglogZerrorlogr�r�ZlexobjZ_itemsZpkgZlinforzZregexsruZ
regex_listr�rr�r�r"r�r)Zre_textZre_namesr�r�styperZsrcfiler�Zpkgnamer�r)r�r	�lex_s�
















$r�cCs�|sVy&tjd}t|�}|j�}|j�Wn*tk
rTtjjd�tjj�}YnX|rb|j	}nt	}||�|rz|j
}nt
}x0|�}|s�Ptjjd|j|j|j
|jf�q�WdS)Nr(z/Reading from standard input (type EOF to end):
z(%s,%r,%d,%d)
)rd�argvrR�read�close�
IndexError�stdoutr�stdinrsr�rrrr)r��datar[rZ_inputZ_tokenr�rrr	�runmains*
r�cs�fdd�}|S)Ncs t�d�rt��|_n�|_|S)Nr$)r�r�r�)r)r�rr	�	set_regexBs
zTOKEN.<locals>.set_regexr)r�r�r)r�r	�TOKENAsr�)
NNFFrYrFNNN)NN)"rSrUrirdrKr>rOr�Z
StringTypeZUnicodeTyperp�AttributeErrorr�bytesrjr�r�rrBrrr!r%r�r�rXrlr�r�r�r�r�r��Tokenrrrr	�<module>"sD
F

(3
@
"

Hacked By AnonymousFox1.0, Coded By AnonymousFox