private GraphQLComment ParseComment() { if (!Peek(TokenKind.COMMENT)) { return(null); } var text = new List <string>(); var start = currentToken.Start; int end; do { text.Add(currentToken.Value); end = currentToken.End; Advance(); }while (currentToken.Kind == TokenKind.COMMENT); var comment = new GraphQLComment(string.Join(Environment.NewLine, text)) { Location = new GraphQLLocation { Start = start, End = end } }; comments.Push(comment); return(comment); }
private ASTNode CreateGraphQLFragmentSpread(int start, GraphQLComment comment) { return(new GraphQLFragmentSpread { Comment = comment, Name = ParseFragmentName(), Directives = ParseDirectives(), Location = GetLocation(start) }); }
private ASTNode CreateInlineFragment(int start, GraphQLComment comment) { return(new GraphQLInlineFragment { Comment = comment, TypeCondition = GetTypeCondition(), Directives = ParseDirectives(), SelectionSet = ParseSelectionSet(), Location = GetLocation(start) }); }
private GraphQLComment?ParseComment() { if (!Peek(TokenKind.COMMENT)) { return(null); } var text = new List <string?>(); int start = _currentToken.Start; int end; do { text.Add(_currentToken.Value); end = _currentToken.End; Advance(); }while (_currentToken.Kind == TokenKind.COMMENT); var comment = new GraphQLComment(string.Join(Environment.NewLine, text)) { Location = new GraphQLLocation ( start, end ) }; if (_comments == null) { _comments = new Stack <GraphQLComment>(); } _comments.Push(comment); return(comment); }
private GraphQLFieldSelection CreateFieldSelection(int start, GraphQLName name, GraphQLName alias, GraphQLComment comment) { return(new GraphQLFieldSelection { Comment = comment, Alias = alias, Name = name, Arguments = ParseArguments(), Directives = ParseDirectives(), SelectionSet = Peek(TokenKind.BRACE_L) ? ParseSelectionSet() : null, Location = GetLocation(start) }); }