summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/graph-gophers/graphql-go/internal/common/directive.go
blob: f767e28f0ace6f9fce7ada7965ef2e55cecd69e9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package common

import "github.com/graph-gophers/graphql-go/types"

func ParseDirectives(l *Lexer) types.DirectiveList {
	var directives types.DirectiveList
	for l.Peek() == '@' {
		l.ConsumeToken('@')
		d := &types.Directive{}
		d.Name = l.ConsumeIdentWithLoc()
		d.Name.Loc.Column--
		if l.Peek() == '(' {
			d.Arguments = ParseArgumentList(l)
		}
		directives = append(directives, d)
	}
	return directives
}