
    %D[ev                         d dl Z d dlZd dlmZ d dlmZ  ej        dej                  Z ej        d          Z	d Z
d Zd Zdd	Zd
 Zedd            Zedd            ZdS )    N)deque)contextmanageraZ  
(
 (?:                     # Start of non-capturing group
  (?:\r\n|\r|\n)      |  # Match any single newline, or
  [^\r\n'"]+          |  # Match any character series without quotes or
                         # newlines, or
  "(?:[^"\\]|\\.)*"   |  # Match double-quoted strings, or
  '(?:[^'\\]|\\.)*'      # Match single quoted strings
 )
)
z(\r\n|\r|\n)c                     t          |           }t                              |          }dg}|D ]E}|st                              |          r|                    d           5|dxx         |z  cc<   F|S )zSplit a string on all unquoted newlines.

    Unlike str.splitlines(), this will ignore CR/LF/CR+LF if the requisite
    character is inside of a string. )strSPLIT_REGEXsplit
LINE_MATCHmatchappend)stmttextlinesoutputlineslines        H/var/www/html/Alfredo/env/lib/python3.11/site-packages/sqlparse/utils.pysplit_unquoted_newlinesr   $   s    
 t99Dd##E$K $ $ 	$d## 	$r""""OOOt#OOOO    c                 Z    | dS | d         dv r| d         | d         k    r
| dd         } | S )z4Helper that removes surrounding quotes from strings.Nr   )"'`r       )vals    r   remove_quotesr   6   s?    
{
1v  SVs2w%6%6!B$iJr   c                        fd}|S )zqFunction decorator to help with recursion

    :param cls: Classes to not recurse over
    :return: function
    c                       fdS )Nc                     |                                  D ]}t          |          s |            |            d S N)get_sublists
isinstance)tlistsgroupclsf	wrapped_fs     r   r(   z(recurse.<locals>.wrap.<locals>.wrapped_fF   sR    ,,.. & &!&#.. &If%%%AeHHHHHr   r   )r'   r(   r&   s   `@r   wrapzrecurse.<locals>.wrapE   s0    	 	 	 	 	 	 	 r   r   )r&   r)   s   ` r   recurser*   ?   s#         Kr   c                 (    |}|rt          |t                    s|gn|}|rt          |t                    s|gn|} dS |rt           |          rdS |rt           fd|D                       rdS |rt           fd|D                       rdS dS )a  Helper function to simplify comparisons Instance, Match and TokenType
    :param token:
    :param i: Class or Tuple/List of Classes
    :param m: Tuple of TokenType & Value. Can be list of Tuple for multiple
    :param t: TokenType or Tuple/List of TokenTypes
    :return:  bool
    NFTc              3   ,   K   | ]} j         | V  d S r!   )r   ).0patterntokens     r   	<genexpr>zimt.<locals>.<genexpr>a   s,      JJW;5;0JJJJJJr   c              3   *   K   | ]}j         |v V  d S r!   )ttype)r-   r2   r/   s     r   r0   zimt.<locals>.<genexpr>c   s*      ??u{e+??????r   )r#   listany)r/   imtclsstypes	mpatternss   `      r   imtr;   Q   s     D9z!T229QEEE=:a#6#6=AI}u	 *UD)) t	 sJJJJ	JJJJJ t	 3????????? tur   c                 N    t          t          j        | |          d           dS )zCAdvance the iterator n-steps ahead. If n is none, consume entirely.r   )maxlenN)r   	itertoolsislice)iteratorns     r   consumerB   i   s(    	)
8Q
'
'222222r   c              #   R   K   | xj         |z  c_         d V  | xj         |z  c_         d S r!   )offsetfilter_rA   s     r   rD   rD   n   3      NNaNN	EEENNaNNNNr   r   c              #   R   K   | xj         |z  c_         d V  | xj         |z  c_         d S r!   )indentrE   s     r   rI   rI   u   rG   r   )NNN)r   )r   )r>   recollectionsr   
contextlibr   compileVERBOSEr	   r   r   r   r*   r;   rB   rD   rI   r   r   r   <module>rO      s       				       % % % % % % bj 
 Z
 
 RZ((
  $    $   03 3 3
          r   