§
    ¡”jg  ã                   óh   — d Z ddlZddlmZ ddlmZ ddlmZmZ ddl	m
Z
  G d„ d¦  «        Zd
d	„ZdS )z	SQL Lexeré    N)ÚLock)Ú
TextIOBase)ÚtokensÚkeywords)Úconsumec                   óf   — e Zd ZdZdZ e¦   «         Zed„ ¦   «         Zd„ Z	d„ Z
d„ Zd„ Zd„ Zd
d	„ZdS )ÚLexerzrThe Lexer supports configurable syntax.
    To add support for additional keywords, use the `add_keywords` method.Nc                 ó¬   — | j         5  | j        €( | ¦   «         | _        | j                             ¦   «          ddd¦  «         n# 1 swxY w Y   | j        S )zRReturns the lexer instance used internally
        by the sqlparse core functions.N)Ú_lockÚ_default_instanceÚdefault_initialization)Úclss    ú]/var/www/finuniver-perm.ru/html/portfolio/venv/lib/python3.11/site-packages/sqlparse/lexer.pyÚget_default_instancezLexer.get_default_instance0   s˜   € ð ŒYð 	?ð 	?ØÔ$Ð,Ø(+¨©¬�Ô%ØÔ%×<Ò<Ñ>Ô>Ð>ð	?ð 	?ð 	?ñ 	?ô 	?ð 	?ð 	?ð 	?ð 	?ð 	?ð 	?øøøð 	?ð 	?ð 	?ð 	?ð Ô$Ð$s   ˆ0AÁAÁAc                 óš  — |                       ¦   «          |                      t          j        ¦  «         |                      t          j        ¦  «         |                      t          j        ¦  «         |                      t          j        ¦  «         |                      t          j        ¦  «         |                      t          j	        ¦  «         |                      t          j
        ¦  «         |                      t          j        ¦  «         |                      t          j        ¦  «         |                      t          j        ¦  «         dS )zlInitialize the lexer with default dictionaries.
        Useful if you need to revert custom syntax settings.N)ÚclearÚset_SQL_REGEXr   Ú	SQL_REGEXÚadd_keywordsÚKEYWORDS_COMMONÚKEYWORDS_ORACLEÚKEYWORDS_MYSQLÚKEYWORDS_PLPGSQLÚKEYWORDS_HQLÚKEYWORDS_MSACCESSÚKEYWORDS_SNOWFLAKEÚKEYWORDS_BIGQUERYÚKEYWORDS©Úselfs    r   r   zLexer.default_initialization:   sý   € ð 	�
Š
‰ŒˆØ×Ò�8Ô-Ñ.Ô.Ð.Ø×Ò�(Ô2Ñ3Ô3Ð3Ø×Ò�(Ô2Ñ3Ô3Ð3Ø×Ò�(Ô1Ñ2Ô2Ð2Ø×Ò�(Ô3Ñ4Ô4Ð4Ø×Ò�(Ô/Ñ0Ô0Ð0Ø×Ò�(Ô4Ñ5Ô5Ð5Ø×Ò�(Ô5Ñ6Ô6Ð6Ø×Ò�(Ô4Ñ5Ô5Ð5Ø×Ò�(Ô+Ñ,Ô,Ð,Ð,Ð,ó    c                 ó"   — g | _         g | _        dS )zãClear all syntax configurations.
        Useful if you want to load a reduced set of syntax configurations.
        After this call, regexps and keyword dictionaries need to be loaded
        to make the lexer functional again.N)Ú
_SQL_REGEXÚ	_keywordsr   s    r   r   zLexer.clearI   s   € ð
 ˆŒØˆŒˆˆr!   c                 ó`   ‡— t           j        t           j        z  Šˆfd„|D ¦   «         | _        dS )z.Set the list of regex that will parse the SQL.c                 óN   •— g | ]!\  }}t          j        |‰¦  «        j        |f‘Œ"S © )ÚreÚcompileÚmatch)Ú.0ÚrxÚttÚFLAGSs      €r   ú
<listcomp>z'Lexer.set_SQL_REGEX.<locals>.<listcomp>T   sA   ø€ ð 
ð 
ð 
á��Bõ ŒZ˜˜EÑ"Ô"Ô(¨"Ð-ð
ð 
ð 
r!   N)r(   Ú
IGNORECASEÚUNICODEr#   )r    r   r.   s     @r   r   zLexer.set_SQL_REGEXQ   s?   ø€ å”¥¤
Ñ*ˆð
ð 
ð 
ð 
à#ð
ñ 
ô 
ˆŒˆˆr!   c                 ó:   — | j                              |¦  «         dS )zhAdd keyword dictionaries. Keywords are looked up in the same order
        that dictionaries were added.N)r$   Úappend)r    r   s     r   r   zLexer.add_keywordsY   s    € ð 	Œ×Ò˜hÑ'Ô'Ð'Ð'Ð'r!   c                 óz   — |                      ¦   «         }| j        D ]}||v r||         |fc S Œt          j        |fS )z¨Checks for a keyword.

        If the given value is in one of the KEYWORDS_* dictionary
        it's considered a keyword. Otherwise, tokens.Name is returned.
        )Úupperr$   r   ÚName)r    ÚvalueÚvalÚkwdicts       r   Ú
is_keywordzLexer.is_keyword^   sT   € ð �kŠk‰mŒmˆØ”nð 	&ð 	&ˆFØ�fˆ}ˆ}Ø˜c”{ EÐ)Ð)Ð)Ð)ð õ ”; Ð%Ð%r!   c              #   ód  K  — t          |t          ¦  «        r|                     ¦   «         }t          |t          ¦  «        rn˜t          |t          ¦  «        rT|r|                     |¦  «        }nk	 |                     d¦  «        }nT# t          $ r |                     d¦  «        }Y n3w xY wt          d                     t          |¦  «        ¦  «        ¦  «        ‚t          |¦  «        }|D ]Ä\  }}| j        D ]§\  }} |||¦  «        }|sŒt          |t          j        ¦  «        r||                     ¦   «         fV — n7|t          j        u r)|                      |                     ¦   «         ¦  «        V — t%          ||                     ¦   «         |z
  dz
  ¦  «          nt          j        |fV — ŒÅdS )a³  
        Return an iterable of (tokentype, value) pairs generated from
        `text`. If `unfiltered` is set to `True`, the filtering mechanism
        is bypassed even if filters are defined.

        Also preprocess the text, i.e. expand tabs and strip it if
        wanted and applies registered filters.

        Split ``text`` into (tokentype, text) pairs.

        ``stack`` is the initial stack (default: ``['root']``)
        zutf-8zunicode-escapez+Expected text or file-like object, got {!r}é   N)Ú
isinstancer   ÚreadÚstrÚbytesÚdecodeÚUnicodeDecodeErrorÚ	TypeErrorÚformatÚtypeÚ	enumerater#   r   Ú
_TokenTypeÚgroupr   ÚPROCESS_AS_KEYWORDr:   r   ÚendÚError)	r    ÚtextÚencodingÚiterableÚposÚcharÚrexmatchÚactionÚms	            r   Ú
get_tokenszLexer.get_tokensk   sÑ  è è € õ �d�JÑ'Ô'ð 	Ø—9’9‘;”;ˆDå�d�CÑ Ô ð 	0ØÝ˜�eÑ$Ô$ð 
	0Øð 9Ø—{’{ 8Ñ,Ô,��ð9ØŸ;š; wÑ/Ô/�D�DøÝ)ð 9ð 9ð 9ØŸ;š;Ð'7Ñ8Ô8�D�D�Dð9øøøõ ÐIß"šF¥4¨¡:¤:Ñ.Ô.ñ0ô 0ð 0õ ˜T‘?”?ˆØ!ð 	)ð 	)‰IˆC�Ø$(¤Oð )ð )Ñ �˜&Ø�H˜T 3Ñ'Ô'�àð 5ØÝ ­Ô(9Ñ:Ô:ð 5Ø  !§'¢'¡)¤)Ð+Ð+Ð+Ð+Ð+Ø�xÔ:Ð:Ð:ØŸ/š/¨!¯'ª'©)¬)Ñ4Ô4Ð4Ð4Ð4å˜ !§%¢%¡'¤'¨C¡-°!Ñ"3Ñ4Ô4Ð4Ø�å”l DÐ(Ð(Ð(Ð(øð	)ð 	)s   Á0B ÂB(Â'B(©N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   Úclassmethodr   r   r   r   r   r:   rT   r'   r!   r   r	   r	      s­   € € € € € ðNð Nð ÐØˆD‰FŒF€Eð( ð%ð %ñ „[ð%ð-ð -ð -ðð ð ð
ð 
ð 
ð(ð (ð (ð
&ð &ð &ð-)ð -)ð -)ð -)ð -)ð -)r!   r	   c                 ó\   — t                                ¦   «                              | |¦  «        S )z�Tokenize sql.

    Tokenize *sql* using the :class:`Lexer` and return a 2-tuple stream
    of ``(token type, value)`` items.
    )r	   r   rT   )ÚsqlrM   s     r   Útokenizer]   ›   s&   € õ ×%Ò%Ñ'Ô'×2Ò2°3¸ÑAÔAÐAr!   rU   )rY   r(   Ú	threadingr   Úior   Úsqlparser   r   Úsqlparse.utilsr   r	   r]   r'   r!   r   ú<module>rb      sº   ðð €Ø 	€	€	€	Ø Ð Ð Ð Ð Ð ð Ð Ð Ð Ð Ð à %Ð %Ð %Ð %Ð %Ð %Ð %Ð %Ø "Ð "Ð "Ð "Ð "Ð "ðA)ð A)ð A)ð A)ð A)ñ A)ô A)ð A)ðHBð Bð Bð Bð Bð Br!   