(tagStr string)
| 563 | } |
| 564 | |
| 565 | func (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 | |
| 605 | func (p *parser) parseInterface() error { |
| 606 | s := p.s |
no test coverage detected