code: func (bh *Header) UnmarshalText(text []byte) error {
  	if bh.seenRefs == nil {
  		bh.seenRefs = set{}
  	}
  	if bh.seenGroups == nil {
  		bh.seenGroups = set{}
  	}
  	if bh.seenProgs == nil {
  		bh.seenProgs = set{}
  	}
  	var t Tag
  	for i, l := range bytes.Split(text, []byte{'\n'}) {
  		if len(l) > 0 && l[len(l)-1] == '\r' {
  			l = l[:len(l)-1]
  		}
  		if len(l) == 0 {
  			continue
  		}
  		if l[0] != '@' || len(l) < 3 {
  			return errBadHeader
  		}
  		copy(t[:], l[1:3])
  		var err error
  		switch t {
  		case headerTag:
  			err = headerLine(l, bh)
  		case refDictTag:
  			err = referenceLine(l, bh)
  		case readGroupTag:
  			err = readGroupLine(l, bh)
  		case programTag:
  			err = programLine(l, bh)
  		case commentTag:
  			err = commentLine(l, bh)
  		default:
  			return errBadHeader
  		}
  		if err != nil {
  			return fmt.Errorf("%v: line %d: %q", err, i+1, l)
  		}
  	}
  
  	return nil
  }
docs: // UnmarshalText implements the encoding.TextUnmarshaler interface.