%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/227033/root/opt/alt/python27/lib/python2.7/site-packages/mako/
Upload File :
Create Path :
Current File : //proc/227033/root/opt/alt/python27/lib/python2.7/site-packages/mako/lexer.pyc

�
�ǚPc@sjdZddlZddlZddlmZmZmZddlmZiZ	de
fd��YZdS(sGprovides the Lexer class for parsing template strings into parse trees.i����N(t	parsetreet
exceptionstutil(tadjust_whitespacetLexercBs�eZdeddd�Zed��Zdd�Zd�Zd�Z	d�Z
ejd�Z
d�Zd�Zd	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�ZRS(cCs�||_||_tj|j�|_d|_d|_d|_d|_g|_	g|_
g|_||_||_
tjr�|r�tjd��n|dkr�g|_n't|d�s�|g|_n	||_dS(Niis4Mako for Python 3 does not support disabling Unicodet__iter__(ttexttfilenameRtTemplateNodettemplatetmatched_linenotmatched_charpostlinenotmatch_positionttagtcontrol_linet
ternary_stacktdisable_unicodetencodingRtpy3kRtUnsupportedErrortNonetpreprocessorthasattr(tselfRRRtinput_encodingR((s;/opt/alt/python27/lib/python2.7/site-packages/mako/lexer.pyt__init__s(											cCs,i|jd6|jd6|jd6|jd6S(NtsourceRtposR(RR
RR(R((s;/opt/alt/python27/lib/python2.7/site-packages/mako/lexer.pytexception_kwargs,s


cCsoyt||f}WnKtk
ra|r?tj||�}ntj|�}|t||f<nX|j|�S(s>compile the given regexp, cache the reg, and call match_reg().(t
_regexp_cachetKeyErrortretcompilet	match_reg(Rtregexptflagstreg((s;/opt/alt/python27/lib/python2.7/site-packages/mako/lexer.pytmatch3s
cCs�|j}|j|j|j�}|r�|j�\}}||krU|d|_n	||_|j|_tjd|j||j!�}|d}x<|dkr�||jkr�|j|dkr�|d8}q�W|||_	|jt
|�7_n|S(s�match the given regular expression object to the current text
        position.

        if a match occurs, update the current text and line position.

        is\nis
(R
R&RtspanRR
R tfindallt
textlengthRtlen(RR%tmpR&tstarttendtlinestcp((s;/opt/alt/python27/lib/python2.7/site-packages/mako/lexer.pyR"As		
1
cGsg|j}dj|�}d}xBtrb|jd�}|rBq!n|jdtj�}|rcq!n|jd|�}|r�|jd�dkr�|dkr�|d8}q!n|j||jt|jd��!|jd�fS|jd|tj�}|r=||jd�j	d	�7}||jd�j	d�8}q!nt
jd
dj|�|j��q!WdS(Nt|is#.*\ns((\"\"\"|\'\'\'|\"|\')((?<!\\)\\\1|.)*?\1s(%s)it}s(.*?)(?=\"|\'|#|%s)t{sExpected: %st,(
R
tjointTrueR&R tStgroupRR*tcountRtSyntaxExceptionR(RRtstartposttext_retbrace_levelR&((s;/opt/alt/python27/lib/python2.7/site-packages/mako/lexer.pytparse_until_text_s8			!
	
c	OsR|jd|j�|jd|j�|jd|j�|j|d<|||�}t|j�r~|jdjj|�n|j	jj|�|j
r|j
d}|jj|�t|tj
�o�|j|j�s|jr|jdr|jddjj|�qqnt|tj�r\t|j�rI|jd|_n|jj|�n�t|tj
�rN|jr�|j
j�|jj�qN|jr�|j
j|�|jjg�qN|j
r�|j
dj|j�r�|jdj|�qN|j
rN|j
dj|j�rNtjd|j|j
djf|j��qNndS(NRRRRi����s1Keyword '%s' not a legal ternary for keyword '%s'(t
setdefaultRR
RRR*RtnodestappendR	Rt
isinstanceRtControlLinet
is_ternarytkeywordRtTagtparenttisendtpopt
is_primaryRR9R(Rtnodeclstargstkwargstnodet
control_frame((s;/opt/alt/python27/lib/python2.7/site-packages/mako/lexer.pytappend_node~sF
	
$	
			s #.*coding[:=]\s*([-\w.]+).*\r?\nc	
Cs�t|t�rL|jj|�}|r6|jd�p?|p?d}||fS|jtj�r�|ttj�}d}|jj|j	dd��}|dk	r2|jd�dkr2tjd|jd�|j	dd�dd|��q2nB|jj|j	dd��}|r&|jd�}n|p/d}|r�y|j	|�}Wq�t
k
r�}tjd||j	dd�dd|��q�Xn||fS(	s�given string/unicode or bytes/string, determine encoding
           from magic encoding comment, return body as unicode
           or raw if decode_raw=False

        itasciisutf-8tignoresHFound utf-8 BOM in file, with conflicting magic encoding comment of '%s'is0Unicode decode operation of encoding '%s' failedN(RAtunicodet
_coding_reR&R7t
startswithtcodecstBOM_UTF8R*tdecodeRRtCompileExceptiontUnicodeDecodeError(	RRt
decode_rawtknown_encodingRtmRtparsed_encodingte((s;/opt/alt/python27/lib/python2.7/site-packages/mako/lexer.pytdecode_raw_stream�s8!
!
cCs�|j|j|j|j|j�\|_|_x#|jD]}||j�|_q;W|j|j�t|j�|_	x�t
rN|j|j	kr�Pn|j�r�Pn|j
�r�q|n|j�r�q|n|j�r�q|n|j�r�q|n|j�rq|n|j�rq|n|j�r&q|n|j|j	kr<Pntjd��q|Wt|j�r�tjd|jdj|j��nt|j�r�tjd|jdj|j|jdj|jdj|j��n|jS(Nsassertion failedsUnclosed tag: <%%%s>i����s"Unterminated control keyword: '%s'(R_RRRRRR"RSR*R)R5R
t	match_endtmatch_expressiontmatch_control_linet
match_commenttmatch_tag_startt
match_tag_endtmatch_python_blockt
match_textRRXRR9RDRRRRR	(Rtpreproc((s;/opt/alt/python27/lib/python2.7/site-packages/mako/lexer.pytparse�sT		
cCsU|jdtjtjBtjB�}|rM|j�\}}}||_i}|r�xTtjd|�D]=}|\}}}	|p�|	}
|
jdd�}
|
||<qfWn|j	t
j||�|r�|jj
�ns|dkrI|jdtj�}|s#tjd|jdj|j��n|j	t
j|jd	��|j�StStSdS(
Ns+
            \<%     # opening tag

            ([\w\.\:]+)   # keyword

            ((?:\s+\w+|\s*=\s*|".*?"|'.*?')*)  # attrname, = \
                                               #        sign, string expression

            \s*     # more whitespace

            (/)?>   # closing

            s)\s*(\w+)\s*=\s*(?:'([^']*)'|\"([^\"]*)\")s
s
Rs(.*?)(?=\</%text>)sUnclosed tag: <%%%s>i����i(R&R tIR6tXtgroupsRDR(treplaceRORRERRHRR9RtTextR7ReR5tFalse(RR&RDtattrRGt
attributestatttkeytval1tval2R((s;/opt/alt/python27/lib/python2.7/site-packages/mako/lexer.pyRds8		
cCs�|jd�}|r�t|j�sItjd|jd�|j��nT|jdj|jd�kr�tjd|jd�|jdjf|j��n|jj�t	St
SdS(Ns\</%[\t ]*(.+?)[\t ]*>s(Closing tag without opening tag: </%%%s>ii����s.Closing tag </%%%s> does not match tag: <%%%s>(R&R*RRR9R7RRDRHR5Ro(RR&((s;/opt/alt/python27/lib/python2.7/site-packages/mako/lexer.pyRe4s

cCs@|jdtj�}|r8|j�}|r1|StSntSdS(Ns\Z(R&R R6R7R5Ro(RR&tstring((s;/opt/alt/python27/lib/python2.7/site-packages/mako/lexer.pyR`FscCsY|jdtjtjB�}|rQ|jd�}|rM|jtj|�ntSt	SdS(Ns�
                (.*?)         # anything, followed by:
                (
                 (?<=\n)(?=[ \t]*(?=%|\#\#)) # an eval or line-based
                                             # comment preceded by a
                                             # consumed newline and whitespace
                 |
                 (?=\${)      # an expression
                 |
                 (?=\#\*)     # multiline comment
                 |
                 (?=</?[%&])  # a substitution or block or call start or end
                              # - don't consume
                 |
                 (\\\r?\n)    # an escaped newline  - throw away
                 |
                 \Z           # end of string
                )i(
R&R RkR6R7RORRnR5Ro(RR&R((s;/opt/alt/python27/lib/python2.7/site-packages/mako/lexer.pyRgQscCs�|jd�}|r�|j|j}}|jd�\}}t|�d}|jtj||jd�dkd|d|�t	St
SdS(Ns<%(!)?s%>s
it!RR(R&R
RR=RRORtCodeR7R5Ro(RR&tlineRRR-((s;/opt/alt/python27/lib/python2.7/site-packages/mako/lexer.pyRfms"cCs�|jd�}|r�|j|j}}|jdd�\}}|dkrd|jd�\}}nd}|jdd�}|jtj||j�d|d	|�t	St
SdS(
Ns\${s\|R1R0ts
s
RR(R&R
RR=RmRORt
ExpressiontstripR5Ro(RR&RyRRR-tescapes((s;/opt/alt/python27/lib/python2.7/site-packages/mako/lexer.pyRa}s
cCsT|jdtj�}|rL|jd�}|jd�}|dkr5tjd|�}|sytjd||j��n|jdd�\}}|dk	}|rt|j	�s�tjd||f|j��q|j	dj
|krtjd	||j	dj
f|j��qn|jtj
|||�n|jtj|�tStSdS(
NsB(?<=^)[\t ]*(%(?!%)|##)[\t ]*((?:(?:\\r?\n)|[^\r\n])*)(?:\r?\n|\Z)iit%s(end)?(\w+)\s*(.*)sInvalid control line: '%s's!No starting keyword '%s' for '%s'i����s'Keyword '%s' doesn't match keyword '%s'(R&R tMR7RR9RRR*RRDRORRBtCommentR5Ro(RR&toperatorRtm2RGRD((s;/opt/alt/python27/lib/python2.7/site-packages/mako/lexer.pyRb�s<
cCsC|jdtj�}|r;|jtj|jd��tStSdS(s*matches the multiline version of a comments<%doc>(.*?)</%doc>iN(	R&R R6RORR�R7R5Ro(RR&((s;/opt/alt/python27/lib/python2.7/site-packages/mako/lexer.pyRc�s
N(t__name__t
__module__RRoRtpropertyRR&R"R=ROR R!RSR_RiRdReR`RgRfRaRbRc(((s;/opt/alt/python27/lib/python2.7/site-packages/mako/lexer.pyRs&			*	(	5	-						#(t__doc__R RUtmakoRRRt
mako.pygenRRtobjectR(((s;/opt/alt/python27/lib/python2.7/site-packages/mako/lexer.pyt<module>s


Zerion Mini Shell 1.0