toSrcPos converts the given position in the input to a Line and column number.
(pos int)
| 98 | // toSrcPos converts the given position in the input to a Line and column |
| 99 | // number. |
| 100 | func (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 | |
| 116 | func clampUint32(v int) uint32 { |
| 117 | switch { |