private InputObjectTypeExtensionNode ParseInputObjectTypeExtension(
            ISyntaxToken start)
        {
            MoveNext();

            NameNode                        name       = ParseName();
            List <DirectiveNode>            directives = ParseDirectives(true);
            List <InputValueDefinitionNode> fields     =
                ParseInputFieldsDefinition();
            var location = new Location(start, _reader.Token);

            if (directives.Count == 0 && fields.Count == 0)
            {
                throw Unexpected(_reader.Kind);
            }

            return(new InputObjectTypeExtensionNode
                   (
                       location,
                       name,
                       directives,
                       fields
                   ));
        }
Beispiel #2
0
        /// <summary>
        /// Parses a interface type or object type field definition.
        /// <see cref="FieldDefinitionNode" />:
        /// Description?
        /// Name ArgumentsDefinition? : Type Directives[isConstant=true]?
        /// </summary>
        /// <param name="context">The parser context.</param>
        private FieldDefinitionNode ParseFieldDefinition()
        {
            ISyntaxToken start = _reader.Token;

            StringValueNode?description = ParseDescription();
            NameNode        name        = ParseName();
            List <InputValueDefinitionNode> arguments = ParseArgumentDefinitions();

            ExpectColon();
            ITypeNode            type       = ParseTypeReference();
            List <DirectiveNode> directives = ParseDirectives(true);

            var location = new Location(start, _reader.Token);

            return(new FieldDefinitionNode
                   (
                       location,
                       name,
                       description,
                       arguments,
                       type,
                       directives
                   ));
        }
Beispiel #3
0
        /// <summary>
        /// Parses an object type definition.
        /// <see cref="ObjectTypeDefinitionNode" />:
        /// Description?
        /// type Name ImplementsInterfaces? Directives[isConstant=true]? FieldsDefinition?
        /// </summary>
        /// <param name="context">The parser context.</param>
        private ObjectTypeDefinitionNode ParseObjectTypeDefinition()
        {
            ISyntaxToken start = _reader.Token;

            // skip type keyword
            MoveNext();

            NameNode                   name       = ParseName();
            List <NamedTypeNode>       interfaces = ParseImplementsInterfaces();
            List <DirectiveNode>       directives = ParseDirectives(true);
            List <FieldDefinitionNode> fields     = ParseFieldsDefinition();

            var location = new Location(start, _reader.Token);

            return(new ObjectTypeDefinitionNode
                   (
                       location,
                       name,
                       TakeDescription(),
                       directives,
                       interfaces,
                       fields
                   ));
        }
Beispiel #4
0
 public UnionTypeExtensionNode WithName(NameNode name)
 {
     return(new UnionTypeExtensionNode(
                Location, name, Directives, Types));
 }
Beispiel #5
0
 public VariableNode WithName(NameNode name)
 {
     return(new VariableNode(Location, name));
 }
 public NamedTypeNode(Location location, NameNode name)
 {
     Location = location;
     Name     = name ?? throw new ArgumentNullException(nameof(name));
 }
 public NamedTypeNode WithName(NameNode name)
 {
     return(new NamedTypeNode(Location, name));
 }
Beispiel #8
0
 public ScalarTypeExtensionNode WithName(NameNode name)
 {
     return(new ScalarTypeExtensionNode(
                Location, name, Directives));
 }
 public ObjectFieldNode WithName(NameNode name)
 {
     return(new ObjectFieldNode(Location, name, Value));
 }
 public EnumTypeExtensionNode WithName(NameNode name)
 {
     return(new EnumTypeExtensionNode(
                Location, name,
                Directives, Values));
 }
 public InputObjectTypeExtensionNode WithName(NameNode name)
 {
     return(new InputObjectTypeExtensionNode(
                Location, name, Directives, Fields));
 }
Beispiel #12
0
 public ObjectTypeExtensionNode WithName(NameNode name)
 {
     return(new ObjectTypeExtensionNode(
                Location, name, Directives,
                Interfaces, Fields));
 }
 public FragmentSpreadNode WithName(NameNode name)
 {
     return(new FragmentSpreadNode(Location, name, Directives));
 }
Beispiel #14
0
 public DirectiveNode WithName(NameNode name)
 {
     return(new DirectiveNode(Location, name, Arguments));
 }
Beispiel #15
0
 public ArgumentNode(Location location, NameNode name, IValueNode value)
 {
     Location = location;
     Name     = name ?? throw new ArgumentNullException(nameof(name));
     Value    = value ?? throw new ArgumentNullException(nameof(value));
 }
Beispiel #16
0
 public ArgumentNode WithName(NameNode name)
 {
     return(new ArgumentNode(Location, name, Value));
 }