public override object VisitDirective(GraphQLParser.DirectiveContext context)
        {
            var directive = new Directive();

            directive.Name = context.NAME().GetText();
            Console.Write("directive: {0}", directive.Name);
            if (context.valueOrVariable() != null)
            {
                var val      = "";
                var valOrVar = context.valueOrVariable();
                if (valOrVar.value() != null)
                {
                    directive.Value = valOrVar.value().GetText();
                    val             = directive.Value.ToString();
                }
                else if (valOrVar.variable() != null)
                {
                    var name = valOrVar.variable().GetText().Substring(1);
                    directive.Variable = new Variable {
                        Name = name
                    };
                    val = name;
                }
                Console.Write(":{0}", val);
            }
            Console.WriteLine();

            return(directive);
        }
Пример #2
0
        public override object VisitDirective(GraphQLParser.DirectiveContext context)
        {
            var directive = new Directive();

            directive.Name = context.NAME().GetText();

            if (context.arguments() != null)
            {
                directive.Arguments = Visit(context.arguments()) as Arguments;
            }

            return(directive);
        }