diff options
author | Michael Muré <batolettre@gmail.com> | 2018-07-29 18:58:42 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-07-29 18:58:42 +0200 |
commit | 8fa0b258ac89781dae269790a4bde09cbcd2f324 (patch) | |
tree | b9bcf0826f5739f128de52123447cede23291c02 /vendor/github.com/graphql-go/graphql/language/location | |
parent | 6363518c85cbd8247a5f6507b8a1dd3903cfb71d (diff) | |
download | git-bug-8fa0b258ac89781dae269790a4bde09cbcd2f324.tar.gz |
cleaning
Diffstat (limited to 'vendor/github.com/graphql-go/graphql/language/location')
-rw-r--r-- | vendor/github.com/graphql-go/graphql/language/location/location.go | 35 |
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} -} |