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

Method skipAfterTag

parser/parser.go:565–603  ·  view source on GitHub ↗
(tagStr string)

Source from the content-addressed store, hash-verified

563}
564
565func (p *parser) skipAfterTag(tagStr string) error {
566 s := p.s
567 if err := skipTagContents(s); err != nil {
568 return err
569 }
570 p.Printf("%s", tagStr)
571 p.skipOutputDepth++
572 defer func() {
573 p.skipOutputDepth--
574 }()
575 for s.Next() {
576 t := s.Token()
577 switch t.ID {
578 case text:
579 // skip text
580 case tagName:
581 ok, err := p.tryParseCommonTags(t.Value)
582 if err != nil {
583 return fmt.Errorf("error when parsing contents after %q: %s", tagStr, err)
584 }
585 if ok {
586 continue
587 }
588 switch string(t.Value) {
589 case "endfunc", "endfor", "endif", "else", "elseif", "case", "default", "endswitch":
590 s.Rewind()
591 return nil
592 default:
593 return fmt.Errorf("unexpected tag found after %q: %q at %s", tagStr, t.Value, s.Context())
594 }
595 default:
596 return fmt.Errorf("unexpected token found when parsing contents after %q: %s at %s", tagStr, t, s.Context())
597 }
598 }
599 if err := s.LastError(); err != nil {
600 return fmt.Errorf("cannot parse contents after %q: %s", tagStr, err)
601 }
602 return fmt.Errorf("cannot find closing tag after %q at %s", tagStr, s.Context())
603}
604
605func (p *parser) parseInterface() error {
606 s := p.s

Callers 1

tryParseCommonTagsMethod · 0.95

Calls 8

PrintfMethod · 0.95
tryParseCommonTagsMethod · 0.95
skipTagContentsFunction · 0.85
NextMethod · 0.80
TokenMethod · 0.80
RewindMethod · 0.80
ContextMethod · 0.80
LastErrorMethod · 0.80

Tested by

no test coverage detected