MCPcopy Index your code
hub / github.com/pquerna/ffjson / PosWithLine

Method PosWithLine

fflib/v1/reader.go:62–76  ·  view source on GitHub ↗

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.

()

Source from the content-addressed store, hash-verified

60// it will iterate the buffer from the beginning, and should
61// only be used in error-paths.
62func (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
78func (r *ffReader) ReadByteNoWS() (byte, error) {
79 if r.i >= r.l {

Callers 2

tErrorFunction · 0.80
WrapErrMethod · 0.80

Calls

no outgoing calls

Tested by 1

tErrorFunction · 0.64