o
    hl                     @   s   d Z dZdZ ddlZdd Zg dZdZd	Zeed
dd eed
d ZdZde	 Zeed
dd eed
d Z
dZed de d e Zed e d e
 d e ZeeZdZeeZdddZdd ZdS )z3.3.0a|  
Module to analyze Python source code; for syntax coloring tools.

Interface::

    tags = fontify(pytext, searchfrom, searchto)

 - The 'pytext' argument is a string containing Python source code.
 - The (optional) arguments 'searchfrom' and 'searchto' may contain a slice in pytext.
 - The returned value is a list of tuples, formatted like this::
    [('keyword', 0, 6, None), ('keyword', 11, 17, None), ('comment', 23, 53, None), etc. ]

 - The tuple contents are always like this::
    (tag, startindex, endindex, sublist)

 - tag is one of 'keyword', 'string', 'comment' or 'identifier'
 - sublist is not used, hence always None.
z0.4    Nc                 C   s   | | |S N)joinsplit)srcseprep r   Y/var/www/html/optinet_system/venv/lib/python3.10/site-packages/reportlab/lib/PyFontify.pyreplace(   s   r
   )asassertexecdelfromlambdareturnandelifglobalnottrybreakelseiforwhileclassexceptimportpasscontinuefinallyinprintdefforisraiseyieldwithz#[^\n]*z$q[^\\q\n]*(\\[\000-\377][^\\q\n]*)*qq'|"a  
    qqq
    [^\\q]*
    (
        (   \\[\000-\377]
        |   q
            (   \\[\000-\377]
            |   [^\q]
            |   q
                (   \\[\000-\377]
                |   [^\\q]
                )
            )
        )
        [^\\q]*
    )*
    qqq
 z(^|[^a-zA-Z0-9_.\"'])()z[ 	]*[A-Za-z_][A-Za-z_0-9.]*c                 C   sT  |d u rt | }tj}tj}g }|j}d}d}d}	d}
d}|}	 || |}|d u r,	 |S | }||kr7	 |S |d}|t | }|d }|dvr||krY|dd }|d }n|d d }|d }||	||d f |d	v r|| |}|d ur| }||kr|d}|t | }||
||d f n|d
kr||||d f n||||d f q )Ncommentstringkeyword
identifierr      z#'")r$   r   #)lenmatchREsearchidREappendstartgroup)pytext
searchfromsearchtor:   idSearchtagstags_append
commentTag	stringTag
keywordTagidentifierTagr=   endmmatchcr   r   r	   fontifyd   sX   
!



rM   c                 C   sL   t | }| }|  t|}|D ]\}}}}t|t|||  qd S r   )openreadcloserM   r#   repr)pathftextrC   tagr=   rI   sublistr   r   r	   test   s   rW   )r   N)__version____doc__rer
   keywordsList
commentPatpatquotePatr   r   tripleQuotePat	nonKeyPatkeyPatmatchPatcompiler9   idKeyPatr;   rM   rW   r   r   r   r	   <module>   s(   


7