
    Dvg                         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        K/var/www/pixelcanvas.ch/venv/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                 :     dS |rt           |          rdS |r?t          |t                    rt           fd|D                       rdS n  j        | rdS |r>t          |t                    rt           fd|D                       rdS n j        |v 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>_   s,      ::W;5;(::::::r   c              3   *   K   | ]}j         |v V  d S r!   )ttype)r-   r2   r/   s     r   r0   zimt.<locals>.<genexpr>e   s*      77E5;%'777777r   )r#   listanyr   r2   )r/   imts   `   r   imtr8   Q   s     }u Zq!! t a 	::::::::: tU[!_ 	4 a 	7777Q77777 t[A45r   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   consumer?   l   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_r>   s     r   rA   rA   q   3      NNaNN	EEENNaNNNNr   r   c              #   R   K   | xj         |z  c_         d V  | xj         |z  c_         d S r!   )indentrB   s     r   rF   rF   x   rD   r   )NNN)r   )r   )r;   recollectionsr   
contextlibr   compileVERBOSEr	   r   r   r   r*   r8   r?   rA   rF   r   r   r   <module>rL      s       				       % % % % % % bj 
 Z
 
 RZ((
  $    $   63 3 3
          r   