aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/vektah/gqlparser/parser/parser.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-12-23 17:11:37 +0100
committerMichael Muré <batolettre@gmail.com>2018-12-23 17:11:37 +0100
commit1410a1af75b1ab9ea3f980a7e372728f9a123abf (patch)
treee24db8f84c48b20158b1f1fd6d281d700421279c /vendor/github.com/vektah/gqlparser/parser/parser.go
parent8fc15a032f021c855abf66ed303c003d57c340ea (diff)
downloadgit-bug-1410a1af75b1ab9ea3f980a7e372728f9a123abf.tar.gz
upgrade gqlgen to v0.7.1
Diffstat (limited to 'vendor/github.com/vektah/gqlparser/parser/parser.go')
-rw-r--r--vendor/github.com/vektah/gqlparser/parser/parser.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/vendor/github.com/vektah/gqlparser/parser/parser.go b/vendor/github.com/vektah/gqlparser/parser/parser.go
index f3648cb3..96e98402 100644
--- a/vendor/github.com/vektah/gqlparser/parser/parser.go
+++ b/vendor/github.com/vektah/gqlparser/parser/parser.go
@@ -82,6 +82,10 @@ func (p *parser) expect(kind lexer.Type) lexer.Token {
}
func (p *parser) skip(kind lexer.Type) bool {
+ if p.err != nil {
+ return false
+ }
+
tok := p.peek()
if tok.Kind != kind {
@@ -110,3 +114,23 @@ func (p *parser) many(start lexer.Type, end lexer.Type, cb func()) {
}
p.next()
}
+
+func (p *parser) some(start lexer.Type, end lexer.Type, cb func()) {
+ hasDef := p.skip(start)
+ if !hasDef {
+ return
+ }
+
+ called := false
+ for p.peek().Kind != end && p.err == nil {
+ called = true
+ cb()
+ }
+
+ if !called {
+ p.error(p.peek(), "expected at least one definition, found %s", p.peek().Kind.String())
+ return
+ }
+
+ p.next()
+}