
    Cj                        S SK Jr  S SKJrJrJrJrJrJrJ	r	  SSK
JrJr  SSKJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJ r J!r!J"r"J#r#J$r$J%r%J&r&J'r'J(r(J)r)J*r*J+r+J,r,J-r-J.r.J/r/J0r0J1r1J2r2J3r3J4r4J5r5J6r6J7r7J8r8J9r9J:r:J;r;J<r<J=r=J>r>J?r?J@r@JArAJBrBJCrCJDrDJErEJFrFJGrGJHrHJIrIJJrJ  SSKKJLrL  SSKMJNrNJOrO  SS	KPJQrQ  SS
KRJSrSJTrT  SSKUJVrV  / SQrW\" S5      rX\\S\Y4   rZ    S S\ZS\[S\\\   S\[S\[S\4S jjr]    S S\ZS\[S\\\   S\[S\[S\H4S jjr^    S S\ZS\[S\\\   S\[S\[S\4S jjr_    S S\ZS\[S\\\   S\[S\[S\D4S jjr`  S!S\ZS\[S\\\   S\<4S jjra " S S5      rbS\BS\Y4S jrcS\VS\Y4S jrdg)"    )partial)CallableDictListOptionalTypeVarUnioncast   )GraphQLErrorGraphQLSyntaxError   )=ArgumentCoordinateNodeArgumentNodeBooleanValueNodeConstArgumentNodeConstDirectiveNodeConstValueNodeDefinitionNodeDirectiveArgumentCoordinateNodeDirectiveCoordinateNodeDirectiveDefinitionNodeDirectiveExtensionNodeDirectiveNodeDocumentNodeEnumTypeDefinitionNodeEnumTypeExtensionNodeEnumValueDefinitionNodeEnumValueNodeFieldDefinitionNode	FieldNodeFloatValueNodeFragmentDefinitionNodeFragmentSpreadNodeInlineFragmentNodeInputObjectTypeDefinitionNodeInputObjectTypeExtensionNodeInputValueDefinitionNodeInterfaceTypeDefinitionNodeInterfaceTypeExtensionNodeIntValueNodeListTypeNodeListValueNodeLocationMemberCoordinateNodeNamedTypeNodeNameNodeNonNullTypeNodeNullValueNodeObjectFieldNodeObjectTypeDefinitionNodeObjectTypeExtensionNodeObjectValueNodeOperationDefinitionNodeOperationTypeOperationTypeDefinitionNodeScalarTypeDefinitionNodeScalarTypeExtensionNodeSchemaCoordinateNodeSchemaDefinitionNodeSchemaExtensionNodeSelectionNodeSelectionSetNodeStringValueNodeTokenTypeCoordinateNodeTypeNodeTypeSystemExtensionNodeUnionTypeDefinitionNodeUnionTypeExtensionNode	ValueNodeVariableDefinitionNodeVariableNodeDirectiveLocation)Lexeris_punctuator_token_kind)SchemaCoordinateLexer)Source	is_source)	TokenKind)parse
parse_typeparse_valueparse_const_valueparse_schema_coordinateTNsourceno_location
max_tokensallow_legacy_fragment_variables0experimental_directives_on_directive_definitionsreturnc                 <    [        U UUUUS9nUR                  5       $ )a  Given a GraphQL source, parse it into a Document.

Throws GraphQLError if a syntax error is encountered.

By default, the parser creates AST nodes that know the location in the source that
they correspond to. Setting the ``no_location`` parameter to False disables that
behavior for performance or testing.

Parser CPU and memory usage is linear to the number of tokens in a document,
however in extreme cases it becomes quadratic due to memory exhaustion.
Parsing happens before validation, so even invalid queries can burn lots of
CPU time and memory. To prevent this, you can set a maximum number of tokens
allowed within a document using the ``max_tokens`` parameter.

Legacy feature (will be removed in v3.3):

If ``allow_legacy_fragment_variables`` is set to ``True``, the parser will
understand and parse variable definitions contained in a fragment definition.
They'll be represented in the
:attr:`~graphql.language.FragmentDefinitionNode.variable_definitions` field
of the :class:`~graphql.language.FragmentDefinitionNode`.

This legacy fragment variable syntax is deprecated. Move variable definitions to
operations for spec-compliant documents; if you need variables or arguments scoped
to fragments, the more complete experimental fragment-arguments feature in
graphql-core 3.3 should be used instead.

The syntax is identical to normal, query-defined variables. For example::

    fragment A($var: Boolean = false) on T  {
      ...
    }

Experimental feature:

If ``experimental_directives_on_directive_definitions`` is set to ``True``, the
parser will understand and parse directives on directive definitions. This syntax
is not part of the GraphQL specification and may change. For example::

    directive @foo @bar on FIELD
r[   r\   r]   r^   )Parserparse_document)rZ   r[   r\   r]   r^   parsers         i/home/rurouni/.local/share/pipx/venvs/strix-agent/lib/python3.13/site-packages/graphql/language/parser.pyrT   rT   W   s/    ` (G<F   ""    c                     [        U UUUUS9nUR                  [        R                  5        UR	                  S5      nUR                  [        R
                  5        U$ )aO  Parse the AST for a given string containing a GraphQL value.

Throws GraphQLError if a syntax error is encountered.

This is useful within tools that operate upon GraphQL Values directly and in
isolation of complete GraphQL documents.

Consider providing the results to the utility function:
:func:`~graphql.utilities.value_from_ast`.
ra   F)rb   expect_tokenrS   SOFparse_value_literalEOFrZ   r[   r\   r]   r^   rd   values          re   rV   rV      sX    " (G<F 	&&&u-E
	&Lrf   c                     [        U UUUUS9nUR                  [        R                  5        UR	                  5       nUR                  [        R
                  5        U$ )zParse the AST for a given string containing a GraphQL constant value.

Similar to parse_value, but raises a arse error if it encounters a variable.
The return type will be a constant value.
ra   )rb   rh   rS   ri   parse_const_value_literalrk   rl   s          re   rW   rW      sV     (G<F 	&,,.E
	&Lrf   c                     [        U UUUUS9nUR                  [        R                  5        UR	                  5       nUR                  [        R
                  5        U$ )aM  Parse the AST for a given string containing a GraphQL Type.

Throws GraphQLError if a syntax error is encountered.

This is useful within tools that operate upon GraphQL Types directly and
in isolation of complete GraphQL documents.

Consider providing the results to the utility function:
:func:`~graphql.utilities.value_from_ast`.
ra   )rb   rh   rS   ri   parse_type_referencerk   )rZ   r[   r\   r]   r^   rd   type_s          re   rU   rU      sV    " (G<F 	&'')E
	&Lrf   c                 >   [        U 5      (       a  [        [        U 5      O[        [        [        U 5      5      n [	        U 5      n[        XX#S9nUR                  [        R                  5        UR                  5       nUR                  [        R                  5        U$ )a  Parse the AST for a given string containing a GraphQL schema coordinate.

Throws GraphQLError if a syntax error is encountered.

This is useful within tools that operate upon GraphQL schema coordinates
(ex. ``Type.field``) directly and in isolation of complete GraphQL documents.

Consider providing the results to the utility function:
:func:`~graphql.utilities.resolve_ast_schema_coordinate`. Or calling
:func:`~graphql.utilities.resolve_schema_coordinate` directly with an
unparsed source.
)r[   r\   lexer)rR   r
   rQ   strrP   rb   rh   rS   ri   rX   rk   )rZ   r[   r\   rt   rd   
coordinates         re   rX   rX      sv    " &/v%6%6T&&!F4VCT<UF!&)EF
XF
	&//1J
	&rf   c                      \ rS rSr% Sr\\S'   \\S'   \\	   \S'   \\S'   \\S'   \	\S'        SS
\
S\S\\	   S\S\S\\   4S jjrS\4S jr\S\	4S j5       rS\4S jrSSSSSSSSS.r\\\4   \S'   0 \R-                  SS 5      ES!S"0Er\\\4   \S#'   S$S%0r\\\4   \S&'   S\4S' jrS\4S( jrS\4S) jrS\\    4S* jr!S\ 4S+ jr"S\#4S, jr$S\%4S- jr&S\'4S. jr(S\)4S/ jr*S0\S\\+   4S1 jr,SS0\S\+4S2 jjr-S\.4S3 jr/S\0\1\24   4S4 jr3S\44S5 jr5S\4S6 jr6S\74S7 jr8\9Rt                  S8\9Rv                  S9\9Rx                  S:\9Rz                  S;\9R|                  S<\9R~                  S<\9R                  S=\9R                  S>0rB\\9\4   \S?'   S0\S\C4S@ jrDSSA\S\E4SB jjrFS0\S\G4SC jrHS0\S\I4SD jrJS0\S\K4SE jrLSSA\S\M4SF jjrNSSA\S\O4SG jjrPSSA\S\C4SH jjrQS0\S\#4SI jrRS\S4SJ jrTS0\S\\U   4SK jrVS\\W   4SL jrXS0\S\U4SM jrYS\Z4SN jr[S\74SO jr\SPSQSRSSSTSUSVSW.r]\\\4   \SX'   S\^4SY jr_S\4SZ jr`S\\E   4S[ jraS\b4S\ jrcS\d4S] jreS\f4S^ jrgS\h4S_ jriS\\7   4S` jrjS\\k   4Sa jrlS\k4Sb jrmS\\n   4Sc jroS\n4Sd jrpS\q4Se jrrS\s4Sf jrtS\\7   4Sg jruS\v4Sh jrwS\\x   4Si jryS\x4Sj jrzS\4Sk jr{S\|4Sl jr}S\\n   4Sm jr~S\4Sn jrS\4So jrS\4Sp jrS\4Sq jrS\4Sr jrS\4Ss jrS\4St jrS\4Su jrS\4Sv jrS\\   4Sw jrS\4Sx jrS\4Sy jrSz\S\\   4S{ jrS|\9S\4S} jrS|\9S\4S~ jrS|\9S\4S jrS\SS	4S jrS\S\4S jrSS\\   S\4S jjrS\9S\/ \4   S\9S\\   4S jrS\9S\/ \4   S\9S\\   4S jrS\9S\/ \4   S\9S\\   4S jrS\9S\/ \4   S\\   4S jrSS jrSrg	)rb   i  a   GraphQL AST parser.

This class is exported only to assist people in implementing their own parsers
without duplicating too much code and should be used only as last resort for cases
such as experimental syntax or if certain features couldn't be contributed upstream.

It's still part of the internal API and is versioned, so any changes to it are never
considered breaking changes. If you still need to support multiple versions of the
library, please use the `__version_info__` variable for version detection.
_lexer_no_location_max_tokens _allow_legacy_fragment_variables1_experimental_directives_on_directive_definitions_token_counterNrZ   r[   r\   r]   r^   rt   c                     [        U5      (       a  [        [        U5      O[        [        [        U5      5      nUb  UO
[	        U5      U l        X l        X0l        X@l        UU l	        SU l
        g )Nr   )rR   r
   rQ   ru   rN   rx   ry   rz   r{   r|   r}   )selfrZ   r[   r\   r]   r^   rt   s          re   __init__Parser.__init__  sf     %.f$5$5D 6$sFBS;T 	  %0eeFm'%0O-< 	>  rf   r_   c                     U R                  [        R                  5      n[        UR                  U R                  U5      S9$ )z0Convert a name lex token into a name parse node.rm   loc)rh   rS   NAMEr1   rm   r   )r   tokens     re   
parse_nameParser.parse_name3  s/    !!)..1ekktxx??rf   c                     U R                   $ )z6Get the number of tokens that have been parsed so far.)r}   r   s    re   token_countParser.token_count:  s     """rf   c                     U R                   R                  n[        U R                  [        R
                  U R                  [        R                  5      U R                  U5      S9nU R                  Ul	        U$ )zDocument: Definition+)definitionsr   )
rx   r   r   manyrS   ri   parse_definitionrk   r   r   )r   startdocuments      re   rc   Parser.parse_document?  sY    !!		)--1F1F	V

  $//rf   schema_definitionscalar_type_definitionobject_type_definitioninterface_type_definitionunion_type_definitionenum_type_definitioninput_object_type_definitiondirective_definition)schemascalartype	interfaceunionenuminput	directive*_parse_type_system_definition_method_names)querymutationsubscriptionoperation_definitionfragmentfragment_definition)_parse_executable_definition_method_namesextendtype_system_extension$_parse_other_definition_method_namesc                     U R                  [        R                  5      (       a  U R                  5       $ U R	                  5       nU(       a  U R
                  R                  5       OU R
                  R                  nU(       a\  UR                  [        R                  L a?  [        U R
                  R                  U R
                  R                  R                  S5      eUR                  [        R                  L Ga  [        [        UR                  5      nU R                   R#                  U5      nU(       a  [%        U SU 35      " 5       $ U R&                  R#                  U5      nU(       a  [%        U SU 35      " 5       $ U(       a?  [        U R
                  R                  U R
                  R                  R                  S5      eU R(                  R#                  U5      nU(       a  [%        U SU 35      " 5       $ U R+                  U5      e)av  Definition: ExecutableDefinition or TypeSystemDefinition/Extension

ExecutableDefinition: OperationDefinition or FragmentDefinition

TypeSystemDefinition: SchemaDefinition, TypeDefinition or DirectiveDefinition

TypeDefinition: ScalarTypeDefinition, ObjectTypeDefinition,
    InterfaceTypeDefinition, UnionTypeDefinition,
    EnumTypeDefinition or InputObjectTypeDefinition
zLUnexpected description, descriptions are not supported on shorthand queries.parse_zFUnexpected description, only GraphQL definitions support descriptions.)peekrS   BRACE_Lparse_operation_definitionpeek_descriptionrx   	lookaheadr   kindr   rZ   r   r   r
   ru   rm   r   getgetattrr   r   
unexpected)r   has_descriptionkeyword_token
token_namemethod_names        re   r   Parser.parse_definition^  s    99Y&&''2244 //1'6DKK!!#DKK<M<M 	 }11Y5F5FF$""!!''H  /c=#6#67JIIMMK tvk]%;<>>HHLLZXKtvk]%;<>>(KK&&KK%%++F  CCGG
SKtvk]%;<>>oom,,rf   c                 (   U R                   R                  nU R                  [        R                  5      (       a:  [        [        R                  SS/ / U R                  5       U R                  U5      S9$ U R                  5       nU R                  5       nU R                  [        R                  5      (       a  U R                  5       OSn[        UUUU R                  5       U R                  S5      U R                  5       U R                  U5      S9$ )OperationDefinitionN)	operationdescriptionnamevariable_definitions
directivesselection_setr   F)rx   r   r   rS   r   r8   r9   QUERYparse_selection_setr   parse_descriptionparse_operation_typer   r   parse_variable_definitionsparse_directives)r   r   r   r   r   s        re   r   !Parser.parse_operation_definition  s    !!99Y&&''*'-- %'"668HHUO  ,,.--/	$(IIinn$=$=t 4&#!%!@!@!B,,U3224
 	
rf   c                     U R                  [        R                  5      n [        UR                  5      $ ! [
         a    U R                  U5      ef = f)z1OperationType: one of query mutation subscription)rh   rS   r   r9   rm   
ValueErrorr   )r   operation_tokens     re   r   Parser.parse_operation_type  sJ    ++INN;	3 !6!677 	3///22	3s	   6 Ac                 t    U R                  [        R                  U R                  [        R                  5      $ )z*VariableDefinitions: (VariableDefinition+))optional_manyrS   PAREN_Lparse_variable_definitionPAREN_Rr   s    re   r   !Parser.parse_variable_definitions  s.    !!t==y?P?P
 	
rf   c           
         U R                   R                  n[        U R                  5       U R	                  5       U R                  [        R                  5      =(       a    U R                  5       U R                  [        R                  5      (       a  U R                  5       OSU R                  5       U R                  U5      S9$ )zCVariableDefinition: Variable: Type DefaultValue? Directives[Const]?N)r   variabler   default_valuer   r   )rx   r   rJ   r   parse_variablerh   rS   COLONrq   expect_optional_tokenEQUALSro   parse_const_directivesr   r   r   s     re   r    Parser.parse_variable_definition  s    !!%..0((*""9??3S8Q8Q8S --i.>.>?? ..0224
 	
rf   c                     U R                   R                  nU R                  [        R                  5        [        U R                  5       U R                  U5      S9$ )zVariable: $Namer   r   )rx   r   rh   rS   DOLLARrK   r   r   r   s     re   r   Parser.parse_variable  sA    !!)**+!2HHrf   c                     U R                   R                  n[        U R                  [        R
                  U R                  [        R                  5      U R                  U5      S9$ )zSelectionSet: {Selection+})
selectionsr   )	rx   r   rA   r   rS   r   parse_selectionBRACE_Rr   r   s     re   r   Parser.parse_selection_set  sP    !!yy!!4#7#79J9J 	
 	
rf   c                     U R                  [        R                  5      (       a  U R                  " 5       $ U R                  " 5       $ )z4Selection: Field or FragmentSpread or InlineFragment)r   rS   SPREADparse_fragmentparse_fieldr   s    re   r   Parser.parse_selection  sD     $(99Y-=-=#>#>DT 	DHDTDTT 	rf   c           
         U R                   R                  nU R                  5       nU R                  [        R
                  5      (       a  UnU R                  5       nOSnUn[        UUU R                  S5      U R                  S5      U R                  [        R                  5      (       a  U R                  5       OSU R                  U5      S9$ )z7Field: Alias? Name Arguments? Directives? SelectionSet?NF)aliasr   	argumentsr   r   r   )rx   r   r   r   rS   r   r!   parse_argumentsr   r   r   r   r   )r   r   name_or_aliasr   r   s        re   r   Parser.parse_field  s    !!)%%ioo66(5E??$DE D**51,,U3.2ii	8I8I.J.J((*PT	
 		
rf   is_constc                     U(       a  U R                   OU R                  nU R                  [        R                  [        [        / [        4   U5      [        R                  5      $ )z%Arguments[Const]: (Argument[?Const]+))	parse_const_argumentparse_argumentr   rS   r   r
   r   r   r   )r   r   items      re   r   Parser.parse_arguments  sN    ,4t(($:M:M!!tHR-=$>EyGXGX
 	
rf   c                     U R                   R                  nU R                  5       nU R                  [        R
                  5        [        X0R                  U5      U R                  U5      S9$ )z%Argument[Const]: Name : Value[?Const]r   rm   r   )	rx   r   r   rh   rS   r   r   rj   r   r   r   r   r   s       re   r   Parser.parse_argument   sT    !! )//*55h?TXXe_
 	
rf   c                 @    [        [        U R                  S5      5      $ )z$Argument[Const]: Name : Value[Const]T)r
   r   r   r   s    re   r   Parser.parse_const_argument
  s    %t':':4'@AArf   c                    U R                   R                  nU R                  [        R                  5        U R                  S5      nU(       d[  U R                  [        R                  5      (       a7  [        U R                  5       U R                  S5      U R                  U5      S9$ [        U(       a  U R                  5       OSU R                  S5      U R                  5       U R                  U5      S9$ )zCorresponds to both FragmentSpread and InlineFragment in the spec.

FragmentSpread: ... FragmentName Directives?
InlineFragment: ... TypeCondition? Directives? SelectionSet
onFr   r   r   N)type_conditionr   r   r   )rx   r   rh   rS   r   expect_optional_keywordr   r   r$   parse_fragment_namer   r   r%   parse_named_typer   )r   r   has_type_conditions      re   r   Parser.parse_fragment  s     !!)**+!99$?!dii	&?&?%--/007HHUO 
 "6H4002d,,U3224	
 	
rf   c                    U R                   R                  nU R                  5       nU R                  S5        U R                  (       ae  [        UU R                  5       U R                  5       U R                  5       U R                  S5      U R                  5       U R                  U5      S9$ [        UU R                  5       U R                  5       U R                  S5      U R                  5       U R                  U5      S9$ )FragmentDefinitionr   F)r   r   r   r  r   r   r   )r   r   r  r   r   r   )rx   r   r   expect_keywordr{   r#   r  r   parse_type_conditionr   r   r   )r   r   r   s      re   parse_fragment_definition Parser.parse_fragment_definition'  s    !!,,.J' 00)'--/%)%D%D%F#88:007"668HHUO  &#))+446,,U3224
 	
rf   c                     U R                   R                  R                  S:X  a  U R                  5       eU R	                  5       $ )z!FragmentName: Name but not ``on``r  )rx   r   rm   r   r   r   s    re   r  Parser.parse_fragment_nameA  s4    ;;""d*//##  rf   c                 D    U R                  S5        U R                  5       $ )zTypeCondition: NamedTyper  )r  r  r   s    re   r  Parser.parse_type_conditionG  s    D!$$&&rf   listobjectintfloatstring_literalnamed_valuesvariable_value!_parse_value_literal_method_namesc                     U R                   R                  U R                  R                  R                  5      nU(       a  [        U SU 35      " U5      $ U R                  5       e)Nr   )r  r   rx   r   r   r   r   )r   r   r   s      re   rj   Parser.parse_value_literalY  sQ    <<@@ARARAWAWX46+!78BBoorf   	_is_constc                     U R                   R                  nU R                  5         [        UR                  UR
                  [        R                  :H  U R                  U5      S9$ )N)rm   blockr   )	rx   r   advance_lexerrB   rm   r   rS   BLOCK_STRINGr   r   r  r   s      re   parse_string_literalParser.parse_string_literal_  sN    !!++**	 6 66
 	
rf   c                     U R                   R                  n[        U R                  U5      n[	        U R                  [        R                  U[        R                  5      U R                  U5      S9$ )zListValue[Const])valuesr   )
rx   r   r   rj   r-   anyrS   	BRACKET_L	BRACKET_Rr   r   r   r   r   s       re   
parse_listParser.parse_listh  sW    !!t//:88I//y7J7JK
 	
rf   c                     U R                   R                  nU R                  5       nU R                  [        R
                  5        [        X0R                  U5      U R                  U5      S9$ )Nr   )	rx   r   r   rh   rS   r   r4   rj   r   r   s       re   parse_object_fieldParser.parse_object_fieldr  sT    !! )//*55h?TXXe_
 	
rf   c                     U R                   R                  n[        U R                  U5      n[	        U R                  [        R                  U[        R                  5      U R                  U5      S9$ )zObjectValue[Const])fieldsr   )
rx   r   r   r0  r7   r)  rS   r   r   r   r,  s       re   parse_objectParser.parse_object{  sW    !!t..988I--tY5F5FG
 	
rf   c                     U R                   R                  nU R                  5         [        UR                  U R                  U5      S9$ Nr   )rx   r   r"  r+   rm   r   r$  s      re   	parse_intParser.parse_int  s6    !!%++488E?CCrf   c                     U R                   R                  nU R                  5         [        UR                  U R                  U5      S9$ r7  )rx   r   r"  r"   rm   r   r$  s      re   parse_floatParser.parse_float  s6    !!EKKTXXe_EErf   c                 N   U R                   R                  nUR                  nU R                  5         US:X  a  [	        SU R                  U5      S9$ US:X  a  [	        SU R                  U5      S9$ US:X  a  [        U R                  U5      S9$ [        X0R                  U5      S9$ )NtrueTr   falseFnull)r   )rx   r   rm   r"  r   r   r3   r   )r   r  r   rm   s       re   parse_named_valuesParser.parse_named_values  s    !!F?#$DHHUODDG#%TXXe_EEF? TXXe_555hhuo>>rf   c                 l   U(       a  U R                  [        R                  5      nU R                  R                  nUR
                  [        R                  L a;  UR                  n[        U R                  R                  UR                  SU S35      eU R                  U5      eU R                  5       $ )NzUnexpected variable '$z' in constant value.)rh   rS   r   rx   r   r   r   rm   r   rZ   r   r   r   )r   r   variable_tokenr   var_names        re   parse_variable_valueParser.parse_variable_value  s    !..y/?/?@NKK%%EzzY^^+ ;;(KK&&"((,XJ6JK 
 //.11""$$rf   c                 @    [        [        U R                  S5      5      $ NT)r
   r   rj   r   s    re   ro    Parser.parse_const_value_literal  s    ND$<$<T$BCCrf   c                     / nUR                   nU R                  [        R                  5      (       a=  U" U R	                  U5      5        U R                  [        R                  5      (       a  M=  U$ )z%Directives[Const]: Directive[?Const]+)appendr   rS   ATparse_directive)r   r   r   rL  s       re   r   Parser.parse_directives  sS    *,
""ii	%%4''12 ii	%%rf   c                 N    [        [        [           U R                  S5      5      $ rI  )r
   r   r   r   r   s    re   r   Parser.parse_const_directives  s     D+,d.C.CD.IJJrf   c                     U R                   R                  nU R                  [        R                  5        [        U R                  5       U R                  U5      U R                  U5      S9$ )z+Directive[Const]: @ Name Arguments[?Const]?)r   r   r   )	rx   r   rh   rS   rM  r   r   r   r   )r   r   r   s      re   rN  Parser.parse_directive  sS    !!),,'"**84
 	
rf   c                    U R                   R                  nU R                  [        R                  5      (       aH  U R                  5       nU R                  [        R                  5        [        X R                  U5      S9nOU R                  5       nU R                  [        R                  5      (       a  [        X0R                  U5      S9$ U$ )z*Type: NamedType or ListType or NonNullType)r   r   )rx   r   r   rS   r*  rq   rh   r+  r,   r   r  BANGr2   )r   r   
inner_typerr   s       re   rq   Parser.parse_type_reference  s    !!%%i&9&9::224Ji112 jhhuoFE))+E%%inn55"88E?CCrf   c                 |    U R                   R                  n[        U R                  5       U R	                  U5      S9$ )zNamedType: Namer   )rx   r   r0   r   r   r   s     re   r  Parser.parse_named_type  s-    !!$//"3%IIrf   schema_extensionscalar_type_extensionobject_type_extensioninterface_type_extensionunion_type_extensionenum_type_extensioninput_object_type_extension)r   r   r   r   r   r   r   "_parse_type_extension_method_namesc                    U R                   R                  5       nUR                  [        R                  :X  a  U R
                  R                  [        [        UR                  5      5      nU(       a  [        U SU 35      " 5       $ UR                  S:X  a!  U R                  (       a  U R                  5       $ U R                  U5      e)TypeSystemExtensionr   r   )rx   r   r   rS   r   ra  r   r
   ru   rm   r   r|   $parse_directive_definition_extensionr   )r   r   r   s      re   parse_type_system_extension"Parser.parse_type_system_extension  s    --//AAEES---.K tvk]%;<>>##{2JJ@@BBoom,,rf   c                     U R                  [        R                  5      =(       d    U R                  [        R                  5      $ N)r   rS   STRINGr#  r   s    re   r   Parser.peek_description  s+    yy))*Odii	8N8N.OOrf   c                 N    U R                  5       (       a  U R                  5       $ g)zDescription: StringValueN)r   r%  r   s    re   r   Parser.parse_description  s#      "",,..rf   c                 8   U R                   R                  nU R                  5       nU R                  S5        U R	                  5       nU R                  [        R                  U R                  [        R                  5      n[        UUUU R                  U5      S9$ )SchemaDefinitionr   )r   r   operation_typesr   )rx   r   r   r  r   r   rS   r   parse_operation_type_definitionr   r>   r   )r   r   r   r   ro  s        re   parse_schema_definitionParser.parse_schema_definition  s    !!,,.H%002
))tCCYEVEV
 $#!+	
 	
rf   c                     U R                   R                  nU R                  5       nU R                  [        R
                  5        U R                  5       n[        X#U R                  U5      S9$ )z2OperationTypeDefinition: OperationType : NamedType)r   r   r   )	rx   r   r   rh   rS   r   r  r:   r   )r   r   r   rr   s       re   rp  &Parser.parse_operation_type_definition  sY    !!--/	)//*%%'*%
 	
rf   c                     U R                   R                  nU R                  5       nU R                  S5        U R	                  5       nU R                  5       n[        UUUU R                  U5      S9$ )zAScalarTypeDefinition: Description? scalar Name Directives[Const]?r   r   r   r   r   )rx   r   r   r  r   r   r;   r   r   r   r   r   r   s        re   parse_scalar_type_definition#Parser.parse_scalar_type_definition  sh    !!,,.H% 002
'#!	
 	
rf   c           
      *   U R                   R                  nU R                  5       nU R                  S5        U R	                  5       nU R                  5       nU R                  5       nU R                  5       n[        UUUUUU R                  U5      S9$ )ObjectTypeDefinitionr   r   r   
interfacesr   r3  r   )
rx   r   r   r  r   parse_implements_interfacesr   parse_fields_definitionr5   r   r   r   r   r   r}  r   r3  s          re   parse_object_type_definition#Parser.parse_object_type_definition$  s    !!,,.F# 557
002
--/'#!!
 	
rf   c                     U R                  S5      (       a*  U R                  [        R                  U R                  5      $ / $ )ImplementsInterfaces
implements)r  delimited_manyrS   AMPr  r   s    re   r~  "Parser.parse_implements_interfaces6  s@     ++L99 	t/D/DE	
 	
rf   c                 t    U R                  [        R                  U R                  [        R                  5      $ )z$FieldsDefinition: {FieldDefinition+})r   rS   r   parse_field_definitionr   r   s    re   r  Parser.parse_fields_definition>  s.    !!t::I<M<M
 	
rf   c           
      F   U R                   R                  nU R                  5       nU R                  5       nU R	                  5       nU R                  [        R                  5        U R                  5       nU R                  5       n[        UUUUUU R                  U5      S9$ )FieldDefinition)r   r   r   r   r   r   )rx   r   r   r   parse_argument_defsrh   rS   r   rq   r   r    r   )r   r   r   r   argsrr   r   s          re   r  Parser.parse_field_definitionD  s    !!,,. ''))//*))+002
"#!
 	
rf   c                 t    U R                  [        R                  U R                  [        R                  5      $ )z,ArgumentsDefinition: (InputValueDefinition+))r   rS   r   parse_input_value_defr   r   s    re   r  Parser.parse_argument_defsV  .    !!t999;L;L
 	
rf   c           
         U R                   R                  nU R                  5       nU R                  5       nU R	                  [
        R                  5        U R                  5       nU R                  [
        R                  5      (       a  U R                  5       OSnU R                  5       n[        UUUUUU R                  U5      S9$ )InputValueDefinitionN)r   r   r   r   r   r   )rx   r   r   r   rh   rS   r   rq   r   r   ro   r   r(   r   )r   r   r   r   rr   r   r   s          re   r  Parser.parse_input_value_def\  s    !!,,. )//*))+ )))*:*:;; **, 	
 002
'#'!
 	
rf   c           
      *   U R                   R                  nU R                  5       nU R                  S5        U R	                  5       nU R                  5       nU R                  5       nU R                  5       n[        UUUUUU R                  U5      S9$ )InterfaceTypeDefinitionr   r|  )
rx   r   r   r  r   r~  r   r  r)   r   r  s          re   parse_interface_type_definition&Parser.parse_interface_type_definitionr  s    !!,,.K( 557
002
--/*#!!
 	
rf   c           	         U R                   R                  nU R                  5       nU R                  S5        U R	                  5       nU R                  5       nU R                  5       n[        UUUUU R                  U5      S9$ )UnionTypeDefinitionr   )r   r   r   typesr   )	rx   r   r   r  r   r   parse_union_member_typesrG   r   )r   r   r   r   r   r  s         re   parse_union_type_definition"Parser.parse_union_type_definition  sy    !!,,.G$ 002
--/&#!
 	
rf   c                     U R                  [        R                  5      (       a*  U R                  [        R                  U R
                  5      $ / $ )UnionMemberTypes)r   rS   r   r  PIPEr  r   s    re   r  Parser.parse_union_member_types  sF     )))*:*:;; 	0E0EF	
 	
rf   c           	         U R                   R                  nU R                  5       nU R                  S5        U R	                  5       nU R                  5       nU R                  5       n[        UUUUU R                  U5      S9$ )r  r   )r   r   r   r(  r   )	rx   r   r   r  r   r   parse_enum_values_definitionr   r   )r   r   r   r   r   r(  s         re   parse_enum_type_definition!Parser.parse_enum_type_definition  sy    !!,,.F# 002
224%#!
 	
rf   c                 t    U R                  [        R                  U R                  [        R                  5      $ )z,EnumValuesDefinition: {EnumValueDefinition+})r   rS   r   parse_enum_value_definitionr   r   s    re   r  #Parser.parse_enum_values_definition  s.    !!t??ARAR
 	
rf   c                     U R                   R                  nU R                  5       nU R                  5       nU R	                  5       n[        UUUU R                  U5      S9$ )z>EnumValueDefinition: Description? EnumValue Directives[Const]?rv  )rx   r   r   parse_enum_value_namer   r   r   rw  s        re   r  "Parser.parse_enum_value_definition  s\    !!,,.))+002
&#!	
 	
rf   c                 (   U R                   R                  R                  S;   a_  [        U R                   R                  U R                   R                  R
                  [        U R                   R                  5       S35      eU R                  5       $ )z7EnumValue: Name but not ``true``, ``false`` or ``null``)r>  r?  r@  z2 is reserved and cannot be used for an enum value.)rx   r   rm   r   rZ   r   get_token_descr   r   s    re   r  Parser.parse_enum_value_name  sv    ;;""&??$""!!''!$++"3"345 69 9    rf   c           	         U R                   R                  nU R                  5       nU R                  S5        U R	                  5       nU R                  5       nU R                  5       n[        UUUUU R                  U5      S9$ )InputObjectTypeDefinitionr   )r   r   r   r3  r   )	rx   r   r   r  r   r   parse_input_fields_definitionr&   r   )r   r   r   r   r   r3  s         re   "parse_input_object_type_definition)Parser.parse_input_object_type_definition  sy    !!,,.G$ 002
335,#!
 	
rf   c                 t    U R                  [        R                  U R                  [        R                  5      $ )z.InputFieldsDefinition: {InputValueDefinition+})r   rS   r   r  r   r   s    re   r  $Parser.parse_input_fields_definition  r  rf   c                 r   U R                   R                  nU R                  S5        U R                  S5        U R                  5       nU R	                  [
        R                  U R                  [
        R                  5      nU(       d  U(       d  U R                  5       e[        X#U R                  U5      S9$ )SchemaExtensionr   r   )r   ro  r   )rx   r   r  r   r   rS   r   rp  r   r   r?   r   )r   r   r   ro  s       re   parse_schema_extensionParser.parse_schema_extension  s    !!H%H%002
,,tCCYEVEV
 ///##"!QV
 	
rf   c                    U R                   R                  nU R                  S5        U R                  S5        U R                  5       nU R	                  5       nU(       d  U R                  5       e[        X#U R                  U5      S9$ )ScalarTypeExtensionr   r   r  )rx   r   r  r   r   r   r<   r   r   r   r   r   s       re   parse_scalar_type_extension"Parser.parse_scalar_type_extension  sq    !!H%H% 002
//##&$((5/
 	
rf   c           	      t   U R                   R                  nU R                  S5        U R                  S5        U R                  5       nU R	                  5       nU R                  5       nU R                  5       nU(       d  U(       d  U(       d  U R                  5       e[        UUUUU R                  U5      S9$ )ObjectTypeExtensionr   r   r   r}  r   r3  r   )
rx   r   r  r   r~  r   r  r   r6   r   r   r   r   r}  r   r3  s         re   parse_object_type_extension"Parser.parse_object_type_extension  s    !!H%F# 557
002
--/jF//##&!!
 	
rf   c           	      t   U R                   R                  nU R                  S5        U R                  S5        U R                  5       nU R	                  5       nU R                  5       nU R                  5       nU(       d  U(       d  U(       d  U R                  5       e[        UUUUU R                  U5      S9$ )InterfaceTypeExtensionr   r   r  )
rx   r   r  r   r~  r   r  r   r*   r   r  s         re   parse_interface_type_extension%Parser.parse_interface_type_extension  s    !!H%K( 557
002
--/jF//##)!!
 	
rf   c                 @   U R                   R                  nU R                  S5        U R                  S5        U R                  5       nU R	                  5       nU R                  5       nU(       d  U(       d  U R                  5       e[        X#X@R                  U5      S9$ )UnionTypeExtensionr   r   )r   r   r  r   )	rx   r   r  r   r   r  r   rH   r   )r   r   r   r   r  s        re   parse_union_type_extension!Parser.parse_union_type_extension"  s    !!H%G$ 002
--/e//##%Exx
 	
rf   c                 @   U R                   R                  nU R                  S5        U R                  S5        U R                  5       nU R	                  5       nU R                  5       nU(       d  U(       d  U R                  5       e[        X#X@R                  U5      S9$ )EnumTypeExtensionr   r   )r   r   r(  r   )	rx   r   r  r   r   r  r   r   r   )r   r   r   r   r(  s        re   parse_enum_type_extension Parser.parse_enum_type_extension0  s    !!H%F# 002
224f//##$V%
 	
rf   c                 @   U R                   R                  nU R                  S5        U R                  S5        U R                  5       nU R	                  5       nU R                  5       nU(       d  U(       d  U R                  5       e[        X#X@R                  U5      S9$ )InputObjectTypeExtensionr   r   )r   r   r3  r   )	rx   r   r  r   r   r  r   r'   r   )r   r   r   r   r3  s        re   !parse_input_object_type_extension(Parser.parse_input_object_type_extension>  s    !!H%G$ 002
335f//##+V%
 	
rf   c                 R   U R                   R                  nU R                  S5        U R                  S5        U R                  [        R
                  5        U R                  5       nU R                  5       nU(       d  U R                  5       e[        UUU R                  U5      S9$ )DirectiveDefinitionExtensionr   r   r  )rx   r   r  rh   rS   rM  r   r   r   r   r   r  s       re   rd  +Parser.parse_directive_definition_extensionL  s    !!H%K(),,' 002
//##%!
 	
rf   c                    U R                   R                  nU R                  5       nU R                  S5        U R	                  [
        R                  5        U R                  5       nU R                  5       nU R                  (       a  U R                  5       O/ nU R                  S5      nU R                  S5        U R                  5       n[        UUUUUUU R                  U5      S9$ )DirectiveDefinitionr   
repeatabler  )r   r   r   r   r  	locationsr   )rx   r   r   r  rh   rS   rM  r   r  r|   r   r  parse_directive_locationsr   r   )r   r   r   r   r  r   r  r  s           re   parse_directive_definition!Parser.parse_directive_definition\  s    !!,,.K(),,' '') EE '') 	
 11,?
D!224	&#!!
 	
rf   c                 V    U R                  [        R                  U R                  5      $ )DirectiveLocations)r  rS   r  parse_directive_locationr   s    re   r   Parser.parse_directive_locationsv  s    ""9>>43P3PQQrf   c                     U R                   R                  nU R                  5       nUR                  [        R
                  ;   a  U$ U R                  U5      erL   )rx   r   r   rm   rM   __members__r   )r   r   r   s      re   r  Parser.parse_directive_locationz  sD    !! ::*666Kooe$$rf   c                 <   U R                   R                  nU R                  [        R                  5      nU R                  5       nSnU(       d4  U R                  [        R                  5      (       a  U R                  5       nSnU(       d  U(       ar  U R                  [        R                  5      (       aN  U R                  5       nU R                  [        R                  5        U R                  [        R                  5        U(       a8  U(       a  [        X5U R                  U5      S9$ [        X0R                  U5      S9$ U(       a;  U(       a  [        UUUU R                  U5      S9$ [        X4U R                  U5      S9$ [!        X0R                  U5      S9$ )z]SchemaCoordinate

- Name
- Name . Name
- Name . Name ( Name : )
- @ Name
- @ Name ( Name : )
N)r   argument_namer   r   )r   
field_namer  r   )r   member_namer   )rx   r   r   rS   rM  r   DOTr   rh   r   r   r   r   r   r   r/   rD   )r   r   of_directiver   r  r  s         re   rX   Parser.parse_schema_coordinate  sA    !!11),,? *. : :9== I I//+K,0KT-G-G.
 .
 !OO-Mioo.i//06  +((5/JJ-*"/	  (  "t%AArf   start_tokenc                     U R                   (       d8  U R                  R                  nU R                  R                  n[	        XU5      $ g)zhReturn a location object.

Used to identify the place in the source that created a given parsed object.
N)ry   rx   
last_tokenrZ   r.   )r   r  	end_tokenrZ   s       re   r   
Parser.loc  s;    
   ..I[[''FKF;;rf   r   c                 H    U R                   R                  R                  U:H  $ )z.Determine if the next token is of a given kind)rx   r   r   )r   r   s     re   r   Parser.peek  s    {{  %%--rf   c           
          U R                   R                  nUR                  U:X  a  U R                  5         U$ [	        U R                   R
                  UR                  S[        U5       S[        U5       S35      e)zExpect the next token to be of the given kind.

If the next token is of the given kind, return that token after advancing the
lexer. Otherwise, do not change the parser state and throw an error.
z	Expected z, found .)	rx   r   r   r"  r   rZ   r   get_token_kind_descr  r   r   r   s      re   rh   Parser.expect_token  sq     !!:: L KKKK+D12(>%;P:QQRS
 	
rf   c                 r    U R                   R                  nUR                  U:X  a  U R                  5         gg)zExpect the next token optionally to be of the given kind.

If the next token is of the given kind, return True after advancing the lexer.
Otherwise, do not change the parser state and return False.
TF)rx   r   r   r"  r  s      re   r   Parser.expect_optional_token  s1     !!:: rf   rm   c           
      "   U R                   R                  nUR                  [        R                  :X  a!  UR
                  U:X  a  U R                  5         g[        U R                   R                  UR                  SU S[        U5       S35      e)zExpect the next token to be a given keyword.

If the next token is a given keyword, advance the lexer.
Otherwise, do not change the parser state and throw an error.
z
Expected 'z	', found r  N)rx   r   r   rS   r   rm   r"  r   rZ   r   r  r   rm   r   s      re   r  Parser.expect_keyword  ss     !!::'EKK5,@ $""UG9^E-B,C1E rf   c                     U R                   R                  nUR                  [        R                  :X  a!  UR
                  U:X  a  U R                  5         gg)zExpect the next token optionally to be a given keyword.

If the next token is a given keyword, return True after advancing the lexer.
Otherwise, do not change the parser state and return False.
TF)rx   r   r   rS   r   rm   r"  r   s      re   r  Parser.expect_optional_keyword  s@     !!::'EKK5,@ rf   at_tokenc                     U=(       d    U R                   R                  n[        U R                   R                  UR                  S[        U5       S35      $ )z>Create an error when an unexpected lexed token is encountered.zUnexpected r  )rx   r   r   rZ   r   r  )r   r  r   s      re   r   Parser.unexpected  sH    -DKK--!KK{>%;P:QQR-S
 	
rf   	open_kindparse_fn
close_kindc                     U R                  U5        / nUR                  n[        U R                  U5      nU" 5       (       d  U" U" 5       5        U" 5       (       d  M  U$ )a  Fetch any matching nodes, possibly none.

Returns a possibly empty list of parse nodes, determined by the ``parse_fn``.
This list begins with a lex token of ``open_kind`` and ends with a lex token of
``close_kind``. Advances the parser to the next lex token after the closing
token.
rh   rL  r   r   r   r  r  r	  nodesrL  r   s          re   r)  
Parser.any  sV     	)$ '(B(BJ O'))8: ())rf   c                     U R                  U5      (       aS  U" 5       /nUR                  n[        U R                   U5      nU" 5       (       d  U" U" 5       5        U" 5       (       d  M  U$ / $ )ad  Fetch matching nodes, maybe none.

Returns a list of parse nodes, determined by the ``parse_fn``. It can be empty
only if the open token is missing, otherwise it will always return a non-empty
list that begins with a lex token of ``open_kind`` and ends with a lex token of
``close_kind``. Advances the parser to the next lex token after the closing
token.
)r   rL  r   r  s          re   r   Parser.optional_many  sb     %%i00ZLE\\F$+D,F,F
$S!+--xz" ,--L	rf   c                     U R                  U5        U" 5       /nUR                  n[        U R                  U5      nU" 5       (       d  U" U" 5       5        U" 5       (       d  M  U$ )a  Fetch matching nodes, at least one.

Returns a non-empty list of parse nodes, determined by the ``parse_fn``. This
list begins with a lex token of ``open_kind`` and ends with a lex token of
``close_kind``. Advances the parser to the next lex token after the closing
token.
r  r  s          re   r   Parser.many'  sZ     	)$ '(B(BJ O'))8: ())rf   delimiter_kindc                     [        U R                  U5      nU" 5         / nUR                  n U" U" 5       5        U" 5       (       d   U$ M  )a-  Fetch many delimited nodes.

Returns a non-empty list of parse nodes, determined by the ``parse_fn``. This
list may begin with a lex token of ``delimiter_kind`` followed by items
separated by lex tokens of ``delimiter_kind``. Advances the parser to the next
lex token after the last item in the list.
)r   r   rL  )r   r  r  r   r  rL  s         re   r  Parser.delimited_many9  sN     !((B(BN S8:(**	 rf   c                 >   U R                   R                  5       nUR                  [        R                  :w  ae  U =R
                  S-  sl        U R                  nUb@  U R
                  U:  a/  [        U R                   R                  UR                  SU S35      eg g g )Nr   zDocument contains more than z tokens. Parsing aborted.)
rx   advancer   rS   rk   r}   rz   r   rZ   r   )r   r   r\   s      re   r"  Parser.advance_lexerM  s    ##%::&1$))J%$*=*=
*J(KK&&KK2:, ?( (  +K% 'rf   )r{   r|   rx   rz   ry   r}   )FNFFN)Frh  )r_   N)__name__
__module____qualname____firstlineno____doc__rN   __annotations__boolr   r  
SourceTyper   r1   r   propertyr   r   rc   r   r   ru   dictfromkeysr   r   r   r   r8   r   r9   r   r   rJ   r   r   rK   r   rA   r   r@   r   r!   r   r   r   r   r   r   r	   r$   r%   r   r#   r  r  r0   r  rS   r*  r   INTFLOATri  r#  r   r   r  rI   rj   rB   r%  r-   r-  r4   r0  r7   r4  r+   r8  r"   r;  rA  rF  r   ro   r   r   r   r   rN  rE   rq   r  ra  rF   re  r   r   r>   rq  r:   rp  r;   rx  r5   r  r~  r    r  r  r(   r  r  r)   r  rG   r  r  r   r  r   r  r  r  r&   r  r  r?   r  r<   r  r6   r  r*   r  rH   r  r   r  r'   r  r   rd  r   r  r  r  r=   rX   rC   r.   r   r   rh   r   r  r  r   r   r   rY   r)  r   r   r  r"  __static_attributes__ rf   re   rb   rb     s   	 M#&**7;;
 "$(05AF!%     SM	 
 *.  ;?   0@H @ #S # #	 	 &*(0(&/+	B.S#X 	A
--=?U
VA)A-tCH~  	)<($sCx. 4-. 4-p
,C 
43m 3
D1G,H 

+A 
 I I
%5 
 
Y 
*
 
l1C 

t 
 
B&7 B
&8:L&L M 
.
+A 
4!X !'m ' 	V8u* 0*	?%tIsN'; 	 D  Y  
d 
 

4 
M 

4 
O 

T 
o 
D4 DL D
FT Fn F

?D 
?Y 
?%T %l %D> D
 $}2E K-?(@ K
 
 
h J- J %)'/'%.:&S#X --D - P$ P8O#< 
)= 
 
1L 

.F 

.F 
$
T--@ 

.A)B 

(; 
$
T*B%C 

'? 
,
1L 
$
-D 
 
$}*= 

,B 
 
d3J.K 

-D 
	!x 	!
4Q 
 
t4L/M 

(; 

-D 

-D 
&
0J 
&
,B 

+@ 

3O 

6L 
 
,C 
4R4> R%( %(B)= (BX	u 	(); 	. .t .
 
u 
")  C D  S T 
8E? 
l 
".6r1uoKT	a$".6r1uoKT	a(".6r1uoKT	a$'3;BE?	a(rf   rb   r   c                 `    U R                   n[        U R                  5      Ub  SU S3-   $ S-   $ )z+Describe a token as a string for debugging.z '' )rm   r  r   )r   rm   s     re   r  r  \  s>    KKEuzz**"UG1 02 rf   r   c                 Z    [        U 5      (       a  SU R                   S3$ U R                  $ )z0Describe a token kind as a string for debugging.r)  )rO   rm   )r   s    re   r  r  d  s(     8 > >Qtzzl!NDJJNrf   )FNFF)FN)e	functoolsr   typingr   r   r   r   r   r	   r
   errorr   r   astr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   directive_locationsrM   rt   rN   rO   schema_coordinate_lexerrP   rZ   rQ   rR   
token_kindrS   __all__rY   ru   r   r  r  rT   rV   rW   rU   rX   rb   r  r  r'  rf   re   <module>r4     s@    G G G 4> > > > > > > > > > > > > > > >~ 3 2 : % ! CL63;

  $,1=B9#9#9# 9# &*	9#
 7;9# 9#|  $,1=B  &*	
 7; D  $,1=B  &*	
 7; :  $,1=B  &*	
 7; D  $  	4Q Qh"% C Oi OC Orf   