
    %h                         S SK r S SKrS SKJr  S SKJr  \R                  " S\R                  5      r\R                  " S5      r	S r
S rS rSS	 jrS
 r\SS j5       r\SS j5       rg)    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                     [        U 5      n[        R                  U5      nS/nU HF  nU(       d  M  [        R	                  U5      (       a  UR                  S5        M9  US==   U-  ss'   MH     U$ )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        @/var/www/html/env/lib/python3.13/site-packages/sqlparse/utils.pysplit_unquoted_newlinesr   $   si    
 t9Dd#E$Kd##r"Ot#O      c                 B    U c  gU S   S;   a  U S   U S   :X  a  U SS n U $ )z4Helper that removes surrounding quotes from strings.Nr   )"'`r       )vals    r   remove_quotesr   6   s5    
{
1v SVs2w%6!BiJr   c                     ^  U 4S jnU$ )zeFunction decorator to help with recursion

:param cls: Classes to not recurse over
:return: function
c                    >^ ^ UU U4S jmT$ )Nc                 z   > U R                  5        H  n[        UT5      (       a  M  T" U5        M      T" U 5        g N)get_sublists
isinstance)tlistsgroupclsf	wrapped_fs     r   r(   (recurse.<locals>.wrap.<locals>.wrapped_fF   s4    ,,.!&#..f% / eHr   r   )r'   r(   r&   s   `@r   wraprecurse.<locals>.wrapE   s    	 r   r   )r&   r*   s   ` r   recurser,   ?   s     Kr   c                 n  ^  T c  gU(       a  [        T U5      (       a  gU(       aF  [        U[        5      (       a  [        U 4S jU 5       5      (       a  gOT R                  " U6 (       a  gU(       aC  [        U[        5      (       a  [        U 4S jU 5       5      (       a  g gT R                  U;   a  gg)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
FTc              3   B   >#    U  H  nTR                   " U6 v   M     g 7fr!   )r   ).0patterntokens     r   	<genexpr>imt.<locals>.<genexpr>_   s     :W5;;(   c              3   B   >#    U  H  nTR                   U;   v   M     g 7fr!   )ttype)r/   r6   r1   s     r   r2   r3   e   s     7QE5;;%'Qr4   )r#   listanyr   r6   )r1   imts   `   r   imtr<   Q   s     }Zq!!a:::: ;[[!_a7Q777 8  [[Ar   c                 @    [        [        R                  " X5      SS9  g)zCAdvance the iterator n-steps ahead. If n is none, consume entirely.r   )maxlenN)r   	itertoolsislice)iteratorns     r   consumerC   l   s    	)

8
'2r   c              #   h   #    U =R                   U-  sl         S v   U =R                   U-  sl         g 7fr!   )offsetfilter_rB   s     r   rE   rE   q   $     NNaN	NNaN   02c              #   h   #    U =R                   U-  sl         S v   U =R                   U-  sl         g 7fr!   )indentrF   s     r   rK   rK   x   rH   rI   )NNN)r   )r   )r?   recollectionsr   
contextlibr   compileVERBOSEr	   r   r   r   r,   r<   rC   rE   rK   r   r   r   <module>rQ      s     	  % jj 
 ZZ
 ZZ(
$$63
    r   