File: directive.go

package info (click to toggle)
golang-github-graph-gophers-graphql-go 1.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,516 kB
  • sloc: sh: 373; javascript: 21; makefile: 5
file content (18 lines) | stat: -rw-r--r-- 403 bytes parent folder | download | duplicates (2)
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/ast"

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