MCPcopy
hub / github.com/grafana/tempo / parseQuotedAtrribute

Function parseQuotedAtrribute

pkg/traceql/lexer.go:283–310  ·  view source on GitHub ↗
(s *scanner.Scanner)

Source from the content-addressed store, hash-verified

281}
282
283func parseQuotedAtrribute(s *scanner.Scanner) (string, error) {
284 var sb strings.Builder
285 s.Next() // consume first quote
286 r := s.Peek()
287 for ; r != scanner.EOF; r = s.Peek() {
288 if r == '"' {
289 s.Next()
290 break
291 } else if r == '\\' {
292 s.Next()
293 if strings.ContainsRune(escapeRunes, s.Peek()) {
294 sb.WriteRune(s.Peek())
295 s.Next()
296 } else {
297 return "", errors.New("invalid escape sequence")
298 }
299 } else {
300 sb.WriteRune(r)
301 s.Next()
302 }
303 }
304
305 if r == scanner.EOF {
306 return "", errors.New(`unexpected EOF, expecting "`)
307 }
308
309 return sb.String(), nil
310}
311
312func tryScopeAttribute(l *scanner.Scanner, currentScope int) (int, bool) {
313 const longestScope = 9 // "resource." is the longest scope

Callers 1

parseAttributeFunction · 0.85

Calls 2

NextMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected