MCPcopy
hub / github.com/valyala/quicktemplate / readText

Method readText

parser/scanner.go:257–297  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

255}
256
257func (s *scanner) readText() bool {
258 s.t.init(text, s.line, s.pos())
259 ok := false
260 for {
261 if !s.nextByte() {
262 ok = (len(s.t.Value) > 0)
263 break
264 }
265 if s.c != '{' {
266 s.appendByte()
267 continue
268 }
269 if !s.nextByte() {
270 s.appendByte()
271 ok = true
272 break
273 }
274 if s.c == '%' {
275 s.nextTokenID = tagName
276 ok = true
277 if !s.nextByte() {
278 s.appendByte()
279 break
280 }
281 if s.c != '-' {
282 s.unreadByte(s.c)
283 break
284 }
285 s.t.Value = prevBlank.ReplaceAll(s.t.Value, nil)
286 break
287 }
288 s.unreadByte('{')
289 s.appendByte()
290 }
291 if s.stripSpaceDepth > 0 {
292 s.t.Value = stripSpace(s.t.Value)
293 } else if s.collapseSpaceDepth > 0 {
294 s.t.Value = collapseSpace(s.t.Value)
295 }
296 return ok
297}
298
299func (s *scanner) readTagName() bool {
300 s.skipSpace()

Callers 1

scanTokenMethod · 0.95

Calls 7

posMethod · 0.95
nextByteMethod · 0.95
appendByteMethod · 0.95
unreadByteMethod · 0.95
stripSpaceFunction · 0.85
collapseSpaceFunction · 0.85
initMethod · 0.80

Tested by

no test coverage detected