Ë
    jûàgg  ã                   ó`   — 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y)z	SQL Lexeré    N)ÚLock)Ú
TextIOBase)ÚtokensÚkeywords)Úconsumec                   óX   — 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y)ÚLexerzrThe Lexer supports configurable syntax.
    To add support for additional keywords, use the `add_keywords` method.Nc                 óÖ   — | j                   5  | j                  €& | «       | _        | j                  j                  «        ddd«       | j                  S # 1 sw Y   | j                  S xY w)zRReturns the lexer instance used internally
        by the sqlparse core functions.N)Ú_lockÚ_default_instanceÚdefault_initialization)Úclss    úL/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/sqlparse/lexer.pyÚget_default_instancezLexer.get_default_instance0   s_   € ð �Y‰Yñ 	?Ø×$Ñ$Ð,Ù(+«�Ô%Ø×%Ñ%×<Ñ<Ô>÷	?ð ×$Ñ$Ð$÷		?ð ×$Ñ$Ð$ús   �3AÁA(c                 ó�  — | j                  «        | j                  t        j                  «       | j	                  t        j
                  «       | j	                  t        j                  «       | j	                  t        j                  «       | j	                  t        j                  «       | j	                  t        j                  «       | j	                  t        j                  «       | j	                  t        j                  «       | j	                  t        j                  «       | j	                  t        j                  «       y)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Ñ2Ô3Ø×Ñœ(×2Ñ2Ô3Ø×Ñœ(×1Ñ1Ô2Ø×Ñœ(×3Ñ3Ô4Ø×Ñœ(×/Ñ/Ô0Ø×Ñœ(×4Ñ4Ô5Ø×Ñœ(×5Ñ5Ô6Ø×Ñœ(×4Ñ4Ô5Ø×Ñœ(×+Ñ+Õ,ó    c                 ó    — g | _         g | _        y)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  }|D ��cg c]'  \  }}t        j                  ||«      j                  |f‘Œ) c}}| _        yc c}}w )z.Set the list of regex that will parse the SQL.N)ÚreÚ
IGNORECASEÚUNICODEÚcompileÚmatchr#   )r    r   ÚFLAGSÚrxÚtts        r   r   zLexer.set_SQL_REGEXQ   sO   € ä—‘¤§
¡
Ñ*ˆð $÷
á��Bô �Z‰Z˜˜EÓ"×(Ñ(¨"Ò-ó
ˆ�ùó 
s   §,Ac                 ó:   — | j                   j                  |«       y)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                 ó‚   — |j                  «       }| j                  D ]  }||v sŒ||   |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^   sI   € ð �k‰k‹mˆØ—n‘nò 	&ˆFØ�fŠ}Ø˜c‘{ EÐ)Ò)ð	&ô —;‘; Ð%Ð%r!   c              #   óú  K  — t        |t        «      r|j                  «       }t        |t        «      rnZt        |t        «      r'|r|j                  |«      }n6	 |j                  d«      }n#t        dj                  t        |«      «      «      ‚t        |«      }|D ]¼  \  }}| j                  D ]”  \  }} |||«      }|sŒt        |t        j                  «      r||j                  «       f–— n3|t        j                   u r!| j#                  |j                  «       «      –— t%        ||j'                  «       |z
  dz
  «        Œ¨ t        j(                  |f–— Œ¾ y# t        $ r |j                  d«      }Y Œéw xY w­w)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_KEYWORDr6   r   ÚendÚError)	r    ÚtextÚencodingÚiterableÚposÚcharÚrexmatchÚactionÚms	            r   Ú
get_tokenszLexer.get_tokensk   sP  è ø€ ô �dœJÔ'Ø—9‘9“;ˆDä�dœCÔ ØÜ˜œeÔ$ÙØ—{‘{ 8Ó,‘ð9ØŸ;™; wÓ/‘Dô ÐIß"™F¤4¨£:Ó.ó0ð 0ô ˜T“?ˆØ!ò 	)‰IˆC�Ø$(§O¡Oò )Ñ �˜&Ù˜T 3Ó'�áØÜ ¬×(9Ñ(9Ô:Ø  !§'¡'£)Ð+Ó+Øœx×:Ñ:Ñ:ØŸ/™/¨!¯'©'«)Ó4Ò4ä˜ !§%¡%£'¨C¡-°!Ñ"3Ô4Ùð)ô —l‘l DÐ(Ó(ñ	)øô *ò 9ØŸ;™;Ð'7Ó8’Dð9üs+   ‚AE;ÁE Á*C1E;ÅE8Å5E;Å7E8Å8E;©N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   Úclassmethodr   r   r   r   r   r6   rP   © r!   r   r	   r	      sI   „ ñNð ÐÙ‹F€Eð( ñ%ó ð%ò-òò
ò(ò
&ô-)r!   r	   c                 óJ   — t         j                  «       j                  | |«      S )z�Tokenize sql.

    Tokenize *sql* using the :class:`Lexer` and return a 2-tuple stream
    of ``(token type, value)`` items.
    )r	   r   rP   )ÚsqlrI   s     r   ÚtokenizerZ   ›   s    € ô ×%Ñ%Ó'×2Ñ2°3¸ÓAÐAr!   rQ   )rU   r&   Ú	threadingr   Úior   Úsqlparser   r   Úsqlparse.utilsr   r	   rZ   rW   r!   r   ú<module>r_      s.   ðñ Û 	Ý õ ç %Ý "÷A)ñ A)ôHBr!   