@@ -18,23 +18,23 @@ const (
18
18
func Parse (queryString string ) (* types.ExecutableDefinition , * errors.QueryError ) {
19
19
l := common .NewLexer (queryString , false )
20
20
21
- var doc * types.ExecutableDefinition
22
- err := l .CatchSyntaxError (func () { doc = parseDocument (l ) })
21
+ var execDef * types.ExecutableDefinition
22
+ err := l .CatchSyntaxError (func () { execDef = parseExecutableDefinition (l ) })
23
23
if err != nil {
24
24
return nil , err
25
25
}
26
26
27
- return doc , nil
27
+ return execDef , nil
28
28
}
29
29
30
- func parseDocument (l * common.Lexer ) * types.ExecutableDefinition {
31
- d := & types.ExecutableDefinition {}
30
+ func parseExecutableDefinition (l * common.Lexer ) * types.ExecutableDefinition {
31
+ ed := & types.ExecutableDefinition {}
32
32
l .ConsumeWhitespace ()
33
33
for l .Peek () != scanner .EOF {
34
34
if l .Peek () == '{' {
35
35
op := & types.OperationDefinition {Type : Query , Loc : l .Location ()}
36
36
op .Selections = parseSelectionSet (l )
37
- d .Operations = append (d .Operations , op )
37
+ ed .Operations = append (ed .Operations , op )
38
38
continue
39
39
}
40
40
@@ -43,24 +43,24 @@ func parseDocument(l *common.Lexer) *types.ExecutableDefinition {
43
43
case "query" :
44
44
op := parseOperation (l , Query )
45
45
op .Loc = loc
46
- d .Operations = append (d .Operations , op )
46
+ ed .Operations = append (ed .Operations , op )
47
47
48
48
case "mutation" :
49
- d .Operations = append (d .Operations , parseOperation (l , Mutation ))
49
+ ed .Operations = append (ed .Operations , parseOperation (l , Mutation ))
50
50
51
51
case "subscription" :
52
- d .Operations = append (d .Operations , parseOperation (l , Subscription ))
52
+ ed .Operations = append (ed .Operations , parseOperation (l , Subscription ))
53
53
54
54
case "fragment" :
55
55
frag := parseFragment (l )
56
56
frag .Loc = loc
57
- d .Fragments = append (d .Fragments , frag )
57
+ ed .Fragments = append (ed .Fragments , frag )
58
58
59
59
default :
60
60
l .SyntaxError (fmt .Sprintf (`unexpected %q, expecting "fragment"` , x ))
61
61
}
62
62
}
63
- return d
63
+ return ed
64
64
}
65
65
66
66
func parseOperation (l * common.Lexer , opType types.OperationType ) * types.OperationDefinition {
0 commit comments