MCPcopy Index your code
hub / github.com/ory/keto / toSrcPos

Method toSrcPos

schema/parse_errors.go:100–114  ·  view source on GitHub ↗

toSrcPos converts the given position in the input to a Line and column number.

(pos int)

Source from the content-addressed store, hash-verified

98// toSrcPos converts the given position in the input to a Line and column
99// number.
100func (e *ParseError) toSrcPos(pos int) (srcPos ketoapi.SourcePosition) {
101 srcPos.Line = 1
102 for _, c := range e.p.lexer.input {
103 srcPos.Col++
104 pos--
105 if pos <= 0 {
106 break
107 }
108 if c == '\n' {
109 srcPos.Line++
110 srcPos.Col = 0
111 }
112 }
113 return
114}
115
116func clampUint32(v int) uint32 {
117 switch {

Callers 3

ErrorMethod · 0.95
ToAPIMethod · 0.95
ToProtoMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected