aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/graphql-go/graphql/language/location/location.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/graphql-go/graphql/language/location/location.go')
-rw-r--r--vendor/github.com/graphql-go/graphql/language/location/location.go35
1 files changed, 0 insertions, 35 deletions
diff --git a/vendor/github.com/graphql-go/graphql/language/location/location.go b/vendor/github.com/graphql-go/graphql/language/location/location.go
deleted file mode 100644
index 04bbde6e..00000000
--- a/vendor/github.com/graphql-go/graphql/language/location/location.go
+++ /dev/null
@@ -1,35 +0,0 @@
-package location
-
-import (
- "regexp"
-
- "github.com/graphql-go/graphql/language/source"
-)
-
-type SourceLocation struct {
- Line int `json:"line"`
- Column int `json:"column"`
-}
-
-func GetLocation(s *source.Source, position int) SourceLocation {
- body := []byte{}
- if s != nil {
- body = s.Body
- }
- line := 1
- column := position + 1
- lineRegexp := regexp.MustCompile("\r\n|[\n\r]")
- matches := lineRegexp.FindAllIndex(body, -1)
- for _, match := range matches {
- matchIndex := match[0]
- if matchIndex < position {
- line++
- l := len(s.Body[match[0]:match[1]])
- column = position + 1 - (matchIndex + l)
- continue
- } else {
- break
- }
- }
- return SourceLocation{Line: line, Column: column}
-}