Calculates the Position with line and line offset, because this isn't counted for performance reasons, it will iterate the buffer from the beginning, and should only be used in error-paths.
()
| 60 | // it will iterate the buffer from the beginning, and should |
| 61 | // only be used in error-paths. |
| 62 | func (r *ffReader) PosWithLine() (int, int) { |
| 63 | currentLine := 1 |
| 64 | currentChar := 0 |
| 65 | |
| 66 | for i := 0; i < r.i; i++ { |
| 67 | c := r.s[i] |
| 68 | currentChar++ |
| 69 | if c == '\n' { |
| 70 | currentLine++ |
| 71 | currentChar = 0 |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | return currentLine, currentChar |
| 76 | } |
| 77 | |
| 78 | func (r *ffReader) ReadByteNoWS() (byte, error) { |
| 79 | if r.i >= r.l { |