
    CjK                        S SK JrJrJr  SSKJr  SSKJr  SSKJ	r	  SSK
JrJrJr  SSKJr  SS	KJr  S
S/r " S S\5      r " S S
5      r\" \R,                  \R.                  \R0                  \R2                  \R4                  \R6                  \R8                  \R:                  \R<                  \R>                  \R@                  \RB                  \RD                  \RF                  \RH                  /5      r%S\S\&4S jr'\R,                  \R.                  \R0                  \R2                  \R4                  \R:                  \R<                  \R>                  \R@                  \RB                  \RD                  \RH                  \RF                  S.r(SSSSSSSSS.r)S\*S\+S\+4S jr,S\*S\+4S  jr-S\*S\&4S! jr.S\*S"\+S\&4S# jr/g$)%    )List
NamedTupleOptional   )GraphQLSyntaxError   )Token)dedent_block_string_lines)is_digitis_name_startis_name_continue)Source)	TokenKindLexeris_punctuator_token_kindc                   .    \ rS rSr% Sr\\S'   \\S'   Srg)EscapeSequence   z6The string value and lexed size of an escape sequence.valuesize N)	__name__
__module____qualname____firstlineno____doc__str__annotations__int__static_attributes__r       h/home/rurouni/.local/share/pipx/venvs/strix-agent/lib/python3.13/site-packages/graphql/language/lexer.pyr   r      s    @J
Ir!   r   c                   :   \ rS rSrSrS\4S jrS\4S jrS\4S jr	S\
S\4S	 jr SS\S\
S\
S\\   S\4
S jjrS\
S\4S jrS\
S\4S jrS\
S\S\4S jrS\
S\S\
4S jrS\
S\4S jrS\
S\4S jrS\
S\4S jrS\
S\4S jrS\
S\4S jrS\
S\4S jrSrg
)r      a(  GraphQL Lexer

A Lexer is a stateful stream generator in that every time it is advanced, it returns
the next token in the Source. Assuming the source lexes, the final Token emitted by
the lexer will be of kind EOF, after which the lexer will repeatedly return the same
EOF token whenever called.
sourcec                     Xl         [        [        R                  SSSS5      =U l        U l        Su  U l        U l        g)z:Given a Source object, initialize a Lexer for that source.r   )r   r   N)r%   r	   r   SOFtoken
last_tokenline
line_start)selfr%   s     r"   __init__Lexer.__init__   s4    ',Y]]Aq!Q'GG
T_%)"	4?r!   returnc                 T    U R                   U l        U R                  5       =ol         U$ )z7Advance the token stream to the next non-ignored token.)r(   r)   	lookahead)r,   r(   s     r"   advanceLexer.advance#   s#    **!^^--
r!   c                 0   U R                   nUR                  [        R                  :w  ak   UR                  (       a  UR                  nO)U R                  UR                  5      nX!l        Xl        UnUR                  [        R                  :w  a   U$ Mj  U$ )zJLook ahead and return the next non-ignored token, but do not change state.)	r(   kindr   EOFnextread_next_tokenendprevCOMMENT)r,   r(   
next_tokens      r"   r1   Lexer.lookahead)   sy    

::&::!JJE "&!5!5eii!@J!+J&+O&E::!2!22  r!   locationc                 R   U R                   R                  nU[        U5      :  a  [        R                  R
                  $ X!   nSUs=::  a  S::  a  O  OUS:X  a  S$ SU S3$ [        [        X!5      (       a&  X!US-    R                  SS5      R                  S5      OU5      nS	US
 3$ )a  Print the code point at the given location.

Prints the code point (or end of file reference) at a given location in a
source for use in error messages.

Printable ASCII is printed quoted, while other points are printed in Unicode
code point form (ie. U+1234).
 ~"z'"''r   utf-16surrogatepasszU+04X)
r%   bodylenr   r6   r   ordis_supplementary_code_pointencodedecode)r,   r>   rG   charpoints        r"   print_code_point_atLexer.print_code_point_at:   s     {{s4y ==&&&~T#V#!S[69$qk9 +4:: HqL)VHo.VH
 E#;r!   Nr5   startr9   r   c                 X    U R                   nSU-   U R                  -
  n[        XX5Xd5      $ )z9Create a token with line and column location information.r   )r*   r+   r	   )r,   r5   rQ   r9   r   r*   cols          r"   create_tokenLexer.create_tokenT   s.     yy%i$//)T#S88r!   c                 H   U R                   R                  n[        U5      nUnXC:  Ga  X$   nUS;   a  US-  nM  US:X  a"  US-  nU =R                  S-  sl        X@l        M?  US:X  a6  X$S-   US-    S:X  a  US-  nOUS-  nU =R                  S-  sl        X@l        M{  US:X  a  U R                  U5      $ US:X  a0  X$S-   US-    S	:X  a  U R                  U5      $ U R                  U5      $ [        R                  U5      nU(       a  U R                  XdUS-   5      $ [        U5      (       d  US
:X  a  U R                  XE5      $ [        U5      (       a  U R                  U5      $ US:X  a1  X$S-   US-    S:X  a#  U R                  [        R                   XDS-   5      $ US:X  a  SOI[#        U5      (       d  [%        X$5      (       a  SU R'                  U5       S3OSU R'                  U5       S3n[)        U R                   XG5      eU R                  [        R*                  X35      $ )zGet the next token from the source starting at the given position.

This skips over whitespace until it finds the next lexable token, then lexes
punctuators immediately or calls the appropriate helper function for more
complicated tokens.
u    	,﻿r   
r   #rB      ""-.z..rC   zNUnexpected single quote character ('), did you mean to use a double quote (")?zUnexpected character: zInvalid character: )r%   rG   rH   r*   r+   read_commentread_block_stringread_string_KIND_FOR_PUNCTgetrT   r   read_numberr   	read_namer   SPREADis_unicode_scalar_valuerJ   rO   r   r6   )r,   rQ   rG   body_lengthpositionrM   r5   messages           r"   r8   Lexer.read_next_token\   s)    {{$i$>D|#AA		Q	"*1x!|4<MHMH		Q	"*s{((22s{1x!|4<11(;;''11"&&t,D((AFF~~''77T""~~h//s{1x!|4<,,Y-=-=xTUVV
 3;;
 /t4424BB -T-E-Eh-O,PPQR /t/G/G/Q.RRST  %T[[(DD  IIr!   c                 $   U R                   R                  n[        U5      nUS-   nXC:  a?  X$   nUS;   a  O4[        U5      (       a  US-  nO[	        X$5      (       a  US-  nOOXC:  a  M?  U R                  [        R                  UUX!S-   U 5      $ )z*Read a comment token from the source file.r   
r   )r%   rG   rH   rf   rJ   rT   r   r;   r,   rQ   rG   rg   rh   rM   s         r"   r^   Lexer.read_comment   s    {{$i19$>Dv~&t,,A,T<<A $   X&	
 	
r!   
first_charc                    U R                   R                  nUnUnSnUS:X  a  US-  nX4US-    nUS:X  aG  US-  nX4US-    n[        U5      (       a*  [        U R                   USU R	                  U5       S35      eOU R                  XE5      nX4US-    nUS:X  a&  SnUS-  nX4US-    nU R                  XE5      nX4US-    nU(       aE  US;   a?  SnUS-  nX4US-    nU(       a  US	;   a  US-  nX4US-    nU R                  XE5      nX4US-    nU(       a@  US:X  d  [        U5      (       a*  [        U R                   US
U R	                  U5       S35      eU R                  U(       a  [        R                  O[        R                  UUX1U 5      $ )zReads a number token from the source file.

This can be either a FloatValue or an IntValue,
depending on whether a FractionalPart or ExponentPart is encountered.
Fr\   r   0z*Invalid number, unexpected digit after 0: r]   TEez+-(Invalid number, expected digit but got: )r%   rG   r   r   rO   read_digitsr   rT   r   FLOATINT)r,   rQ   ro   rG   rh   rM   is_floats          r"   rc   Lexer.read_number   s    {{3;MH8a<0D3;MH8a<0D~~(KK00:;1>   ''7H8a<0D3;HMH8a<0D''7H8a<0DDDLHMH8a<0DAx!|4''7H8a<0D TS[M$$7$7$,,X67q:    'IOOY]]x 	
 	
r!   c                 0   [        U5      (       d*  [        U R                  USU R                  U5       S35      eU R                  R                  n[        U5      nUS-   nXT:  a0  [        X5   5      (       a  US-  nXT:  a  [        X5   5      (       a  M  U$ )zGReturn the new position in the source after reading one or more digits.rs   r]   r   )r   r   r%   rO   rG   rH   )r,   rQ   ro   rG   rg   rh   s         r"   rt   Lexer.read_digits   s    
##$,,U34A7  {{$i19$$.)A)AMH $$.)A)Ar!   c                    U R                   R                  n[        U5      nUS-   nUn/ nUR                  nXC:  Ga0  X$   nUS:X  a>  U" X%U 5        U R	                  [
        R                  UUS-   SR                  U5      5      $ US:X  a}  U" X%U 5        X$S-   US-    S:X  a0  X$S-   US-    S:X  a  U R                  U5      O!U R                  U5      OU R                  U5      n	U" U	R                  5        XIR                  -  nUnM  US	;   a  O^[        U5      (       a  US-  nO@[        X$5      (       a  US-  nO*[        U R                   US
U R!                  U5       S35      eXC:  a  GM0  [        U R                   US5      e)z6Read a single-quote string token from the source file.r   rB    \r   urZ   {rl   !Invalid character within String: r]   Unterminated string.)r%   rG   rH   appendrT   r   STRINGjoin#read_escaped_unicode_variable_width read_escaped_unicode_fixed_widthread_escaped_characterr   r   rf   rJ   r   rO   )
r,   rQ   rG   rg   rh   chunk_startr   r   rM   escapes
             r"   r`   Lexer.read_string  s   {{$i19$>Ds{t12(($$qLGGEN	  t|t12 qL8a<8C?  1x!|<C @@J!BB8L 44X>  v||$KK'&v~&t,,A,T<<A(KK00:;1> I $V !h8NOOr!   rh   c           	         U R                   R                  nSnSn[        S[        U5      U-
  5      nXE:  ak  X!U-      nUS-  nUS:X  a:  US:  d  SUs=::  a  S::  d  O  SUs=::  a  S	::  d  O  O4[	        [        U5      U5      $ US
-  [        U5      -  nUS:  a  OXE:  a  Mk  [        U R                   USX!X-     S35      e)Nr   rZ      r   }            "Invalid Unicode escape sequence: ''.)r%   rG   minrH   r   chrread_hex_digitr   )r,   rh   rG   rN   r   max_sizerM   s          r"   r   )Lexer.read_escaped_unicode_variable_width;  s    {{r3t9x/0o4(DAIDs{!8(&(Fe,Gx,G%c%j$77aZ>$#77Eqy o !KK01P0QQST
 	
r!   c           	         U R                   R                  n[        X!S-   5      nSUs=::  a  S::  d  O  SUs=::  a  S::  a  O  O[        [	        U5      S5      $ SUs=::  a  S::  ao  O  OlX!S-   US	-    S
:X  a^  [        X!S	-   5      nSUs=::  a  S::  aC  O  O@[        [	        U5      [	        U5      -   R                  SS5      R                  S5      S5      $ [        U R                   USX!US-     S35      e)Nr   r   r   r   r      i   i     z\ui   i  rD   rE   r   r   r   )r%   rG   read_16_bit_hex_coder   r   rK   rL   r   )r,   rh   rG   codetrailing_codes        r"   r   &Lexer.read_escaped_unicode_fixed_widthV  s    {{#DQ,7&D"<H"<!#d)Q// T#V#qL8a<0E9 4Ta< H]4f4)TS%77/:)	  !KK011M0NbQ
 	
r!   c           	          U R                   R                  n[        R                  X!S-      5      nU(       a  [	        US5      $ [        U R                   USX!US-     S35      e)Nr   r   z$Invalid character escape sequence: 'r   )r%   rG   _ESCAPED_CHARSrb   r   r   )r,   rh   rG   r   s       r"   r   Lexer.read_escaped_characterp  sf    {{""41#56!%++ KK24(Q,3O2PPRS
 	
r!   c           
      f   U R                   R                  n[        U5      nU R                  nUS-   nUnSn/ nXS:  Ga]  X%   n	U	S:X  a  X%S-   US-    S:X  a}  XrXe -  nUR	                  U5        U R                  [        R                  UUS-   SR                  [        U5      5      5      n
U =R                  [        U5      S-
  -  sl
        X@l        U
$ U	S:X  a   X%S-   US-    S	:X  a  XrXe -  nUS-   nUS-  nM  U	S
;   a>  XrXe -  nUR	                  U5        U	S:X  a  X%S-   US-    S:X  a  US-  nOUS-  nSnU=pdGM  [        U	5      (       a  US-  nO@[        X%5      (       a  US-  nO*[        U R                   USU R                  U5       S35      eXS:  a  GM]  [        U R                   US5      e)z/Read a block string token from the source file.rZ   r|   rB   r   r[   rW   r}   r   z"""rl   rX   r   r   r]   r   )r%   rG   rH   r+   r   rT   r   BLOCK_STRINGr   r
   r*   rf   rJ   r   rO   )r,   rQ   rG   rg   r+   rh   r   current_lineblock_linesrM   r(   s              r"   r_   Lexer.read_block_string{  s   {{$i__
19$>Ds{tqL8a<@DH[ ::""<0))**qLII7DE 		S-11	",t|\HqL AU J[ ::&lAv~[ ::""<04<DA1$E$MMHMH!+33&t,,A,T<<A(KK00:;1> W $d !h8NOOr!   c                     U R                   R                  n[        U5      nUS-   nXC:  a!  X$   n[        U5      (       d  OUS-  nXC:  a  M!  U R	                  [
        R                  XX!U 5      $ )z7Read an alphanumeric + underscore name from the source.r   )r%   rG   rH   r   rT   r   NAMErm   s         r"   rd   Lexer.read_name  so    {{$i19$>D#D))MH	 $   $XBVWWr!   )r)   r*   r+   r%   r(   )N)r   r   r   r   r   r   r-   r	   r2   r1   r   r   rO   r   r   rT   r8   r^   rc   rt   r`   r   r   r   r   r_   rd   r    r   r!   r"   r   r      sU   *v * 5 " C  C  6 MQ99&)9039<DSM9	9CJS CJU CJJ
# 
% 
09
 9
# 9
% 9
v # # "4P 4P 4Pl
C 
N 
6
 
 
4	
s 	
~ 	
=Ps =Pu =P~Xs Xu Xr!   r5   r/   c                     U [         ;   $ )zXCheck whether the given token kind corresponds to a punctuator.

For internal use only.
)_punctuator_token_kinds)r5   s    r"   r   r     s    
 ***r!   )!$&():=@[]r   r   |rB   /r}   rW   rX   	)rB   r   r}   bfnrtrG   rh   c                     [        X   5      S-  [        XS-      5      S-  -  [        XS-      5      S-  -  [        XS-      5      -  $ )aK  Read a 16bit hexadecimal string and return its positive integer value (0-65535).

Reads four hexadecimal characters and returns the positive integer that 16bit
hexadecimal string represents. For example, "000f" will return 15, and "dead"
will return 57005.

Returns a negative number if any char was not a valid hexadecimal digit.
r   r   r   r   r   rZ   )r   )rG   rh   s     r"   r   r     s`     	t~&",
l+
,
1	2
l+
,
1	2 l+
,	-r!   rM   c                     SU s=::  a  S::  a  O  O[        U 5      S-
  $ SU s=::  a  S::  a  O  O[        U 5      S-
  $ SU s=::  a  S::  a  O  g
[        U 5      S	-
  $ g
)zRead a hexadecimal character and returns its positive integer value (0-15).

'0' becomes 0, '9' becomes 9
'A' becomes 10, 'F' becomes 15
'a' becomes 10, 'f' becomes 15

Returns -1 if the provided character code was not a valid hexadecimal digit.
rq   90   AF7   ar   W   )rI   rM   s    r"   r   r     s]     dc4y2~			4y2~			 4y2~r!   c                 d    SU s=:*  =(       a    S:*  Os  =(       d    SU s=:*  =(       a    S:*  $ s  $ )zCheck whether this is a Unicode scalar value.

A Unicode scalar value is any Unicode code point except surrogate code
points. In other words, the inclusive ranges of values 0x0000 to 0xD7FF and
0xE000 to 0x10FFFF.
 u   ퟿u   u   􏿿r   r   s    r"   rf   rf   (  s/     T%%X%IT)I)I\)II)IIr!   r>   c                      SX   s=:*  =(       a    S:*  Os  =(       a    SXS-      s=:*  =(       a    S:*  $ s  $ ! [          a     gf = f)z
Check whether the current location is a supplementary code point.

The GraphQL specification defines source text as a sequence of unicode scalar
values (which Unicode defines to exclude surrogate code points).
u   u   u   r   u   F)
IndexError)rG   r>   s     r"   rJ   rJ   2  sV    22(2 ;DA.::(:	
:	
  s   4: : 
AAN)0typingr   r   r   errorr   astr	   block_stringr
   character_classesr   r   r   r%   r   
token_kindr   __all__r   r   	frozensetBANGDOLLARAMPPAREN_LPAREN_RDOTre   COLONEQUALSAT	BRACKET_L	BRACKET_RBRACE_LPIPEBRACE_Rr   boolr   ra   r   r   r   r   r   rf   rJ   r   r!   r"   <module>r      s   - - &  3 H H  !.
/Z rX rXj $ *+9 + + 
																												$ 
	
						s c c &  $J# J$ Jc S T r!   