MCPcopy Create free account
hub / github.com/prometheus/common / startOfLine

Method startOfLine

expfmt/text_parse.go:144–163  ·  view source on GitHub ↗

startOfLine represents the state where the next byte read from p.buf is the start of a line (or whitespace leading up to it).

()

Source from the content-addressed store, hash-verified

142// startOfLine represents the state where the next byte read from p.buf is the
143// start of a line (or whitespace leading up to it).
144func (p *TextParser) startOfLine() stateFn {
145 p.lineCount++
146 if p.skipBlankTab(); p.err != nil {
147 // This is the only place that we expect to see io.EOF,
148 // which is not an error but the signal that we are done.
149 // Any other error that happens to align with the start of
150 // a line is still an error.
151 if errors.Is(p.err, io.EOF) {
152 p.err = nil
153 }
154 return nil
155 }
156 switch p.currentByte {
157 case '#':
158 return p.startComment
159 case '\n':
160 return p.startOfLine // Empty line, start the next one.
161 }
162 return p.readingMetricName
163}
164
165// startComment represents the state where the next byte read from p.buf is the
166// start of a comment (or whitespace leading up to it).

Callers 1

Calls 1

skipBlankTabMethod · 0.95

Tested by 1