
    +h3                     P    d dl mZ d dl mZ d dlZd dlmZ d dlmZ  G d d      Zy)    )BytesIO)StringION)lexer)	parsetreec                   ,    e Zd ZdZd Zd Zed        Zy)MessageExtractorTc              #      K   t        j                  |j                         | j                  d         j	                         }| j                  |j                               E d {    y 7 w)Nencoding)input_encoding)r   Lexerreadconfigparseextract_nodesget_children)selffileobjtemplate_nodes      C/var/www/html/venv/lib/python3.12/site-packages/mako/ext/extract.pyprocess_filezMessageExtractor.process_file   sQ     LLN4;;z+B

%' 	 %%m&@&@&BCCCs   A#A-%A+&A-c           
   #     K   g }d}| j                   d   xs d}t        t        d t        j                  d| j                   d                     }|D ]u  }d }|r5t        |t        j                        r|j                  j                         s=t        |t        j                        r|j                  j                         }|r,|j                  | j                  |j                  |             |D ]A  }	|j                  |	      sd}|j                  | j                  |j                  |             C t        |t        j                         r$|j"                  j$                  }
|j&                  }n}t        |t        j(                        r$|j*                  j$                  }
|j&                  }n?t        |t        j,                        r$|j$                  j$                  }
|j&                  }nt        |t        j.                        r|j*                  j$                  }
nt        |t        j0                        r|j2                  }
|j&                  }nt        |t        j4                        r|j6                  rd}.|j                  }
nft        |t        j8                        rd}|j$                  j$                  }
n3t        |t        j:                        r|j$                  j$                  }
n|r|d   d   |j                  d	z
  k  rg }|D cg c]  }|d	   	 }}t        |
t<              r| j>                  r|
jA                  |d
      }
d}| j>                  rtC        d|
z         }
ntE        d|
z         }
| jG                  |
|j                  d	z
  |      D ]  }| d}
 |rg }d}|s]| jI                  |      E d {    x y c c}w 7 w)NFr
   asciiz\s+zcomment-tagsTr      backslashreplace   

)%r   listfilterresplit
isinstancer   TextcontentstripCommenttextextend_split_commentlineno
startswithDefTagfunction_declcodenodesBlockTag	body_declCallTagPageTagCallNamespaceTag
expressionControlLineisendCode
Expressionstr	use_bytesencoder   r   process_pythonr   )r   r/   translator_commentsin_translator_commentsr   comment_tagsnodechild_nodesvaluecomment_tagr.   commenttranslator_stringsused_translator_commentsmessages                  r   r   zMessageExtractor.extract_nodes   sA     !&Z0;G4&$++n*EFG
  X	;DK&tY^^4**, $	 1 12		))'..++DKK? #/ K''415.+22 //UC $	 0 01)).."jjD)"4"45~~**"jjD)"3"34yy~~"jjD)"3"34~~**D)"<"<="jjD)"7"78::-2*yyD)..1).&yy~~D)"6"67yy~~ $'+A.q@&(# +>"&
" " $${{>3EF',$ ~~ut|,t,..dkkAo'9 0 +/(	0 (&(#%*"--k:::qX	;v": ;s,   DOHOOBO/OOOc                 p    t        |j                               D cg c]  \  }}| |z   |f c}}S c c}}w )zzReturn the multiline comment at lineno split into a list of
        comment line numbers and the accompanying comment line)	enumerate
splitlines)r*   rE   indexlines       r   r)   zMessageExtractor._split_commentz   s?      )););)=>
t e^T"
 	
 
s   2N)__name__
__module____qualname__r;   r   r   staticmethodr)        r   r   r      s(    ID`;D 
 
rS   r   )ior   r   r    makor   r   r   rR   rS   r   <module>rV      s"      	  r
 r
rS   