+
    WBi?                     V    R t ^ RIt^ RIt^ RIHt ^ RIHt ^ RIHt / t ! R R4      t	R# )zGprovides the Lexer class for parsing template strings into parse trees.N)
exceptions)	parsetree)adjust_whitespacec                      a  ] tR t^t o RR lt]R 4       tRR ltR tR t	R t
]P                  ! R4      tR	 tR
 tR tR tR tR tR tR tR tR tR tRtV tR# )LexerNc                4   Wn         W n        \        P                  ! V P                  4      V n        ^V n        ^ V n        ^V n        ^ V n        . V n	        . V n
        . V n        W0n        Vf
   . V n        R# \        VR4      '       g   V.V n        R# W@n        R# )   N__iter__)textfilenamer   TemplateNodetemplatematched_linenomatched_charposlinenomatch_positiontagcontrol_lineternary_stackencodingpreprocessorhasattr)selfr
   r   input_encodingr   s   &&&&&//usr/lib/python3.14/site-packages/mako/lexer.py__init__Lexer.__init__   s     	 !..t}}= & "Dz22!-D ,    c                f    R V P                   RV P                  RV P                  RV P                  /# )sourcer   posr   )r
   r   r   r   )r   s   &r   exception_kwargsLexer.exception_kwargs*   s6     diid))4''	
 	
r   c                     \         W3,          pV P	                  V4      #   \         dB    T'       d   \        P                  ! Y4      M\        P                  ! T4      pT\         Y3&    L\i ; i)z>compile the given regexp, cache the reg, and call match_reg().)_regexp_cacheKeyErrorrecompile	match_reg)r   regexpflagsregs   &&& r   matchLexer.match3   s\    	10C
 ~~c""	  	1/4"**V+"**V:LC-0M6/*	1s   ! A-6A-,A-c                   V P                   pVP                  V P                  V P                   4      pV'       d   VP                  4       w  rEWT8X  d
   V^,           MTV n         V P                  V n        V^,
          pV^ 8  d6   W`P                  8  d&   V P                  RV^,            P                  R4      pW&,
          V n        V ;P                  V P                  W P                    P                  R4      ,          un        V# )zmatch the given regular expression object to the current text
position.

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

N
)
r   r,   r
   spanr   r   
textlengthrfindr   count)r   r+   mpr,   startendcps   &&     r   r(   Lexer.match_reg>   s       		$))T%8%89 ::<LU-0\#'sD"&++DaBQw2/YYxa(..t4#%7D KK499R*=*=>DDTJJKr   c                   V P                   pR P                  V4      p^ p^ p^ p V P                  R4      pV'       d   K  V P                  R\        P                  4      pV'       d   KF  V P                  RV,          4      pV'       df   V'       d   V^ 8  gW   V^ 8  gP   V^ 8  gI   V P
                  W0P                   \        VP                  ^4      4      ,
           VP                  ^4      3# V'       g(   V P                  RV,          \        P                  4      pV'       d   WXP                  ^4      P                  R4      ,          pWXP                  ^4      P                  R4      ,          pWhP                  ^4      P                  R4      ,          pWhP                  ^4      P                  R4      ,          pWxP                  ^4      P                  R	4      ,          pWxP                  ^4      P                  R
4      ,          pEK  \        P                  ! RRP                  V4      ,          3/ V P                  B h)|z#.*\nz+(\"\"\"|\'\'\'|\"|\')[^\\]*?(\\.[^\\]*?)*\1z(%s)z(.*?)(?=\"|\'|#|%s){}()[]zExpected: %s,)r   joinr,   r&   Sr
   lengroupr3   r   SyntaxExceptionr!   )	r   watch_nestingr
   startpostext_rebrace_levelparen_levelbracket_levelr,   s	   &&*      r   parse_until_textLexer.parse_until_textT   s   &&))D/JJx(EJJ>E JJw01E 1_a=1;L II #6#6U[[^9L#L KKN	  

#9G#CRTTJ{{1~33C88{{1~33C88{{1~33C88{{1~33C88Q!5!5c!::Q!5!5c!::,,$/373H3H r   c                   VP                  R V P                  4       VP                  RV P                  4       VP                  RV P                  4       V P                  VR&   V! V/ VB p\        V P                  4      '       d.   V P                  R,          P                  P                  V4       M%V P                  P                  P                  V4       V P                  '       d   V P                  R,          pVP                  P                  V4       \        V\        P                  4      '       d"   VP                  VP                  4      '       g_   V P                   '       dM   V P                   R,          '       d4   V P                   R,          R,          P                  P                  V4       \        V\        P"                  4      '       dQ   \        V P                  4      '       d   V P                  R,          Vn        V P                  P                  V4       R# \        V\        P                  4      '       Ed   VP&                  '       d7   V P                  P)                  4        V P                   P)                  4        R# VP*                  '       d9   V P                  P                  V4       V P                   P                  . 4       R# V P                  '       dW   V P                  R,          P                  VP                  4      '       d%   V P                   R,          P                  V4       R# V P                  '       d   V P                  R,          P                  VP                  4      '       gP   \,        P.                  ! RVP                  : RV P                  R,          P                  : R23/ V P0                  B hR# R# R# )	r   r   r    r   	Keyword 'z#' not a legal ternary for keyword ''N)
setdefaultr
   r   r   r   rD   r   nodesappendr   r   
isinstancer   ControlLine
is_ternarykeywordr   Tagparentisendpop
is_primaryr   rF   r!   )r   nodeclsargskwargsnodecontrol_frames   &&*,  r   append_nodeLexer.append_node|   s   (DII.(D$7$78%!5!56!]]z''txx==HHRL%%d+MM&&t,
  --b1M&&t, tY%:%:;;%00>>&&&&&r**""2&r*0077=dIMM**488}}"hhrlHHOOD!i3344zzz!!%%'""&&(!!((.""))"-"""t'8'8'<'G'G( ( ""2&--d3"""4+<+<R+@+K+K, , !00||T%6%6r%:%B%BD ++ ," 5r   z #.*coding[:=]\s*([-\w.]+).*\r?\nc                   \        V\        4      '       dN   V P                  P                  V4      pT;'       d    VP	                  ^4      ;'       g    T;'       g    RpWa3# VP                  \        P                  4      '       d   V\        \        P                  4      R pRpV P                  P                  VP                  RR4      4      pVeW   VP	                  ^4      R8w  dA   \        P                  ! RVP	                  ^4      ,          VP                  RR4      ^ ^ V4      hMPV P                  P                  VP                  RR4      4      pV'       d   VP	                  ^4      MT;'       g    RpV'       d    VP                  V4      pWq3# Wq3#   \         d3    \        P                  ! RT,          TP                  RR4      ^ ^ T4      hi ; i)zgiven string/unicode or bytes/string, determine encoding
from magic encoding comment, return body as unicode
or raw if decode_raw=False

zutf-8NignorezHFound utf-8 BOM in file, with conflicting magic encoding comment of '%s'z0Unicode decode operation of encoding '%s' failed)rV   str
_coding_rer,   rE   
startswithcodecsBOM_UTF8rD   decoder   CompileExceptionUnicodeDecodeError)r   r
   
decode_rawknown_encodingr   mr   parsed_encodings   &&&&&   r   decode_raw_streamLexer.decode_raw_stream   s    dC  %%d+A''QWWQZDD>DDWH>!??6??++FOO,./D%O%%dkk'8&DEA}w!6 11578wwqzBKK2  %%dkk'8&DEA,-aggaj>3L3LWO
{{?3 $$$$ &  11F%&KK2 s   F =Gc                   V P                  V P                  R V P                  V P                  4      w  V n        V n        V P                   F  pV! V P                  4      V n        K  	  V P                  V P                  4       \        V P                  4      V n         V P                  V P                  8  d   EM	V P                  4       '       d   MV P                  4       '       d   KM  V P                  4       '       d   Ke  V P                  4       '       d   K}  V P                  4       '       d   K  V P                  4       '       d   K  V P!                  4       '       d   K  V P#                  4       '       d   K  V P%                  4       '       d   K  V P                  V P                  8  d   M\&        P(                  ! R4      h\        V P*                  4      '       dD   \&        P,                  ! RV P*                  R,          P.                  ,          3/ V P0                  B h\        V P2                  4      '       d   \&        P,                  ! RV P2                  R,          P.                  ,          V P                  V P2                  R,          P4                  V P2                  R,          P6                  V P                  4      hV P8                  # )Tzassertion failedUnclosed tag: <%%%s>z"Unterminated control keyword: '%s'rR   )rt   r
   r   r   r   r(   ri   rD   r1   r   	match_endmatch_expressionmatch_control_linematch_commentmatch_tag_startmatch_tag_endmatch_python_blockmatch_percent
match_textr   MakoExceptionr   rF   rY   r!   r   r   r    r   )r   preprocs   & r   parseLexer.parse   s   #'#9#9IItT]]DMM$
 ty ((G		*DI )
 	t'dii.""T__4~~$$&&&&((!!####%%!!##&&((!!##  ""T__4**+=>>txx==,,&")=)==''  t  !!,,4##B'//0		!!"%,,!!"%))  }}r   c                l   R pV P                  V\        P                  \        P                  ,          \        P                  ,          4      pV'       g   R# VP                  4       w  r4pW0n        / pV'       dF   \        P                  ! RV4       F*  pVw  rp
T	;'       g    T
pVP                  RR4      pWV&   K,  	  V P                  \        P                  W64       V'       d   V P                  P                  4        R# VR8X  d   V P                  R\        P                  4      pV'       gD   \        P                  ! RV P                  R	,          P                  ,          3/ V P                   B hV P                  \        P"                  VP%                  ^4      4       V P'                  4       # R# )
a  
            \<%     # opening tag

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

            ((?:\s+\w+|\s*=\s*|"[^"]*?"|'[^']*?'|\s*,\s*)*)  # attrname, = \
                                               #        sign, string expression
                                               # comma is for backwards compat
                                               # identified in #366

            \s*     # more whitespace

            (/)?>   # closing

        Fz)\s*(\w+)\s*=\s*(?:'([^']*)'|\"([^\"]*)\")
r/   r
   z(.*?)(?=\</%text>)rw   TrR   )r,   r&   IrC   XgroupsrY   findallreplacerd   r   rZ   r   r]   r   rF   r!   TextrE   r}   )r   r+   r,   rY   attrr\   
attributesattkeyval1val2r
   s   &           r   r|   Lexer.match_tag_start  sR     

DD244K"$$

 $||~u
zz<d #&4||t||FD1"&3 	<HHLLN  JJ4bdd;E 00*TXXb\-A-AA++  Y^^U[[^<%%''r   c                   V P                  R 4      pV'       d   \        V P                  4      '       g8   \        P                  ! RVP                  ^4      ,          3/ V P                  B hV P                  R,          P                  VP                  ^4      8w  dU   \        P                  ! RVP                  ^4      : RV P                  R,          P                  : R23/ V P                  B hV P                  P                  4        R# R# )z\</%[\t ]*([^\t ]+?)[\t ]*>z(Closing tag without opening tag: </%%%s>zClosing tag </%z> does not match tag: <%>TFrR   )	r,   rD   r   r   rF   rE   r!   rY   r]   r   r,   s   & r   r}   Lexer.match_tag_endF  s    

9:txx== 00>kk!n% ++ 
 "%%Q7 00{{1~txx|';';= ++ 
 HHLLNr   c                    V P                  R \        P                  4      pV'       g   R# VP                  4       pV'       d   V# R# )z\ZFT)r,   r&   rC   rE   )r   r,   strings   &  r   rx   Lexer.match_endZ  s2    

5"$$'Mr   c                    V P                  R \        P                  4      pV'       dO   V P                  \        P
                  VP                  ^4      R,           VP                  ^4      ,           4       R# R# )z(?<=^)(\s*)%%(%*)%TF)r,   r&   Mrd   r   r   rE   r   s   & r   r   Lexer.match_percente  sS    

/6A 4u{{1~ E r   c                    V P                  R \        P                  \        P                  ,          4      pV'       d<   VP	                  ^4      pV'       d!   V P                  \        P                  V4       R# R# )a  
                (.*?)         # anything, followed by:
                (
                 (?<=\n)(?=[ \t]*(?=%|\#\#))  # an eval or line-based
                                            # comment, preceded by a
                                            # consumed newline and whitespace
                 |
                 (?=\${)      # an expression
                 |
                 (?=</?%)  # a substitution or block or call start or end
                              # - don't consume
                 |
                 (\\\r?\n)    # an escaped newline  - throw away
                 |
                 \Z           # end of string
                )TF)r,   r&   r   rC   rE   rd   r   r   )r   r,   r
   s   &  r   r   Lexer.match_texto  sU    

  DD244K#
( ;;q>D  6r   c                "   V P                  R 4      pV'       dv   V P                  V P                  r2V P                  RR4      w  rE\	        V4      R,           pV P                  \        P                  VVP                  ^4      R8H  VVR7       R# R# )z<%(!)?Fz%>r/   !r   r    T)	r,   r   r   rM   r   rd   r   CoderE   )r   r,   liner    r
   r6   s   &     r   r~   Lexer.match_python_block  s    

9%++T-A-A#--eU;ID %T*T1DA#%   r   c                X   V P                  R 4      pV'       g   R# V P                  V P                  r2V P                  RRR4      w  rEVR8X  d   V P                  RR4      w  reMRpVP	                  RR4      pV P                  \        P                  VVP                  4       VVR	7       R# )
z\${FTz\|r<   r:    r   r/   r   )	r,   r   r   rM   r   rd   r   
Expressionstrip)r   r,   r   r    r
   r6   escapess   &      r   ry   Lexer.match_expression  s    

6"'')=)=c))$t<	#:00t<LGSG||FD)  MMO 	 	
 r   c                Z   V P                  R \        P                  4      pV'       g   R# VP                  ^4      pVP                  ^4      pVR8X  Ed7   \        P                   ! RV4      pV'       g)   \        P
                  ! RV,          3/ V P                  B hVP                  ^^4      w  rVVRJpV'       d   \        V P                  4      '       g+   \        P
                  ! RV: RV: R23/ V P                  B hV P                  R,          P                  V8w  dF   \        P
                  ! R	V: R
V P                  R,          P                  : R23/ V P                  B hV P                  \        P                  WeV4       R# V P                  \        P                  V4       R# )zC(?<=^)[\t ]*(%(?!%)|##)[\t ]*((?:(?:\\\r?\n)|[^\r\n])*)(?:\r?\n|\Z)Fr   z(end)?(\w+)\s*(.*)zInvalid control line: '%s'NzNo starting keyword 'z' for 'rQ   rP   z' doesn't match keyword 'TrR   )r,   r&   r   rE   r   rF   r!   rD   r   rY   rd   r   rW   Comment)r   r,   operatorr
   m2r\   rY   s   &      r   rz   Lexer.match_control_line  sp   

DD

 ;;q>{{1~s?/6B 00047++   XXa^NE%E4,,--$44?FM//  &&r*22g=$44!2!22!6!>!>@ // 
 Y22GDI  Y..5r   c                    V P                  R\        P                  4      pV'       d2   V P                  \        P
                  VP                  ^4      4       R# R# )z*matches the multiline version of a commentz<%doc>(.*?)</%doc>TF)r,   r&   rC   rd   r   r   rE   r   s   & r   r{   Lexer.match_comment  s>    

0"$$7Y..A?r   )r   r   r   rY   r   r   r   r   r   r   r   r   r
   r1   )NNN)N)__name__
__module____qualname____firstlineno__r   propertyr!   r,   r(   rM   rd   r&   r'   ri   rt   r   r|   r}   rx   r   r   r~   ry   rz   r{   __static_attributes____classdictcell__)__classdict__s   @r   r   r      s     -, 
 
	#,&P0d ?@J(%T8t0d(	:&*$L r   r   )
__doc__rk   r&   makor   r   
mako.pygenr   r$   r    r   r   <module>r      s+    N  	   (N Nr   