MCPcopy
hub / github.com/caddyserver/caddy / NumLineBreaks

Method NumLineBreaks

caddyconfig/caddyfile/lexer.go:351–360  ·  view source on GitHub ↗

NumLineBreaks counts how many line breaks are in the token text.

()

Source from the content-addressed store, hash-verified

349
350// NumLineBreaks counts how many line breaks are in the token text.
351func (t Token) NumLineBreaks() int {
352 lineBreaks := strings.Count(t.Text, "\n")
353 if t.wasQuoted == '<' {
354 // heredocs have an extra linebreak because the opening
355 // delimiter is on its own line and is not included in the
356 // token Text itself, and the trailing newline is removed.
357 lineBreaks += 2
358 }
359 return lineBreaks
360}
361
362// Clone returns a deep copy of the token.
363func (t Token) Clone() Token {

Callers 1

isNextOnNewLineFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected