// Code generated by "go run clone_generate.go"; DO NOT EDIT.

package dns

import (
	"net/netip"

	"codeberg.org/miekg/dns/internal/dnslex"
	"codeberg.org/miekg/dns/internal/dnsstring"
	"codeberg.org/miekg/dns/rdata"
)

func parseCNAME(rd *rdata.CNAME, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.Target = dnsutilAbsolute(l.Token, o)
	if l.Value == dnslex.Error || rd.Target == "" {
		return &ParseError{err: "bad CNAME Target", lex: l}
	}
	return toParseError(dnslex.Discard(c))
}

func parseMB(rd *rdata.MB, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.Mb = dnsutilAbsolute(l.Token, o)
	if l.Value == dnslex.Error || rd.Mb == "" {
		return &ParseError{err: "bad MB Mb", lex: l}
	}
	return toParseError(dnslex.Discard(c))
}

func parseMG(rd *rdata.MG, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.Mg = dnsutilAbsolute(l.Token, o)
	if l.Value == dnslex.Error || rd.Mg == "" {
		return &ParseError{err: "bad MG Mg", lex: l}
	}
	return toParseError(dnslex.Discard(c))
}

func parseMINFO(rd *rdata.MINFO, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.Rmail = dnsutilAbsolute(l.Token, o)
	if l.Value == dnslex.Error || rd.Rmail == "" {
		return &ParseError{err: "bad MINFO Rmail", lex: l}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.Email = dnsutilAbsolute(l.Token, o)
	if l.Value == dnslex.Error || rd.Email == "" {
		return &ParseError{err: "bad MINFO Email", lex: l}
	}
	return toParseError(dnslex.Discard(c))
}

func parseMR(rd *rdata.MR, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.Mr = dnsutilAbsolute(l.Token, o)
	if l.Value == dnslex.Error || rd.Mr == "" {
		return &ParseError{err: "bad MR Mr", lex: l}
	}
	return toParseError(dnslex.Discard(c))
}

func parseMF(rd *rdata.MF, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.Mf = dnsutilAbsolute(l.Token, o)
	if l.Value == dnslex.Error || rd.Mf == "" {
		return &ParseError{err: "bad MF Mf", lex: l}
	}
	return toParseError(dnslex.Discard(c))
}

func parseMD(rd *rdata.MD, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.Md = dnsutilAbsolute(l.Token, o)
	if l.Value == dnslex.Error || rd.Md == "" {
		return &ParseError{err: "bad MD Md", lex: l}
	}
	return toParseError(dnslex.Discard(c))
}

func parseMX(rd *rdata.MX, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.Preference, err = dnsstring.AtoiUint16(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad MX Preference", lex: l}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.Mx = dnsutilAbsolute(l.Token, o)
	if l.Value == dnslex.Error || rd.Mx == "" {
		return &ParseError{err: "bad MX Mx", lex: l}
	}
	return toParseError(dnslex.Discard(c))
}

func parseAFSDB(rd *rdata.AFSDB, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.Subtype, err = dnsstring.AtoiUint16(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad AFSDB Subtype", lex: l}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.Hostname = dnsutilAbsolute(l.Token, o)
	if l.Value == dnslex.Error || rd.Hostname == "" {
		return &ParseError{err: "bad AFSDB Hostname", lex: l}
	}
	return toParseError(dnslex.Discard(c))
}

func parseX25(rd *rdata.X25, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.PSDNAddress = l.Token
	if l.Value == dnslex.Error || rd.PSDNAddress == "" {
		return &ParseError{err: "bad X25 PSDNAddress", lex: l}
	}
	return toParseError(dnslex.Discard(c))
}

func parseRT(rd *rdata.RT, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.Preference, err = dnsstring.AtoiUint16(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad RT Preference", lex: l}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.Host = dnsutilAbsolute(l.Token, o)
	if l.Value == dnslex.Error || rd.Host == "" {
		return &ParseError{err: "bad RT Host", lex: l}
	}
	return toParseError(dnslex.Discard(c))
}

func parseNS(rd *rdata.NS, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.Ns = dnsutilAbsolute(l.Token, o)
	if l.Value == dnslex.Error || rd.Ns == "" {
		return &ParseError{err: "bad NS Ns", lex: l}
	}
	return toParseError(dnslex.Discard(c))
}

func parsePTR(rd *rdata.PTR, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.Ptr = dnsutilAbsolute(l.Token, o)
	if l.Value == dnslex.Error || rd.Ptr == "" {
		return &ParseError{err: "bad PTR Ptr", lex: l}
	}
	return toParseError(dnslex.Discard(c))
}

func parseRP(rd *rdata.RP, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.Mbox = dnsutilAbsolute(l.Token, o)
	if l.Value == dnslex.Error || rd.Mbox == "" {
		return &ParseError{err: "bad RP Mbox", lex: l}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.Txt = dnsutilAbsolute(l.Token, o)
	if l.Value == dnslex.Error || rd.Txt == "" {
		return &ParseError{err: "bad RP Txt", lex: l}
	}
	return toParseError(dnslex.Discard(c))
}

func parseSOA(rd *rdata.SOA, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.Ns = dnsutilAbsolute(l.Token, o)
	if l.Value == dnslex.Error || rd.Ns == "" {
		return &ParseError{err: "bad SOA Ns", lex: l}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.Mbox = dnsutilAbsolute(l.Token, o)
	if l.Value == dnslex.Error || rd.Mbox == "" {
		return &ParseError{err: "bad SOA Mbox", lex: l}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.Serial, err = dnsstring.AtoiUint32(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad SOA Serial", lex: l}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.Refresh, err = dnsstring.AtoiUint32(l.Token)
	if l.Value == dnslex.Error || err != nil {
		var ok bool
		rd.Refresh, ok = stringToTTL(l.Token)
		if !ok {
			return &ParseError{err: "bad SOA Refresh", lex: l}
		}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.Retry, err = dnsstring.AtoiUint32(l.Token)
	if l.Value == dnslex.Error || err != nil {
		var ok bool
		rd.Retry, ok = stringToTTL(l.Token)
		if !ok {
			return &ParseError{err: "bad SOA Retry", lex: l}
		}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.Expire, err = dnsstring.AtoiUint32(l.Token)
	if l.Value == dnslex.Error || err != nil {
		var ok bool
		rd.Expire, ok = stringToTTL(l.Token)
		if !ok {
			return &ParseError{err: "bad SOA Expire", lex: l}
		}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.Minttl, err = dnsstring.AtoiUint32(l.Token)
	if l.Value == dnslex.Error || err != nil {
		var ok bool
		rd.Minttl, ok = stringToTTL(l.Token)
		if !ok {
			return &ParseError{err: "bad SOA Minttl", lex: l}
		}
	}
	return toParseError(dnslex.Discard(c))
}

func parseIPN(rd *rdata.IPN, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.Node, err = dnsstring.AtoiUint64(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad IPN Node", lex: l}
	}
	return toParseError(dnslex.Discard(c))
}

func parseSRV(rd *rdata.SRV, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.Priority, err = dnsstring.AtoiUint16(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad SRV Priority", lex: l}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.Weight, err = dnsstring.AtoiUint16(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad SRV Weight", lex: l}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.Port, err = dnsstring.AtoiUint16(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad SRV Port", lex: l}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.Target = dnsutilAbsolute(l.Token, o)
	if l.Value == dnslex.Error || rd.Target == "" {
		return &ParseError{err: "bad SRV Target", lex: l}
	}
	return toParseError(dnslex.Discard(c))
}

func parseCERT(rd *rdata.CERT, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.Type, err = dnsstring.AtoiUint16(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad CERT Type", lex: l}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.KeyTag, err = dnsstring.AtoiUint16(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad CERT KeyTag", lex: l}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.Algorithm, err = dnsstring.AtoiUint8(l.Token)
	if l.Value == dnslex.Error || err != nil {
		var ok bool
		rd.Algorithm, ok = upperLookup(l.Token, StringToAlgorithm)
		if !ok {
			return &ParseError{err: "bad CERT Algorithm", lex: l}
		}
		return &ParseError{err: "bad CERT Algorithm", lex: l}
	}

	c.Next() // dnslex.Blank

	rd.Certificate, err = remainder(c, "bad CERT Certificate")
	return err
}

func parseDNAME(rd *rdata.DNAME, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.Target = dnsutilAbsolute(l.Token, o)
	if l.Value == dnslex.Error || rd.Target == "" {
		return &ParseError{err: "bad DNAME Target", lex: l}
	}
	return toParseError(dnslex.Discard(c))
}

func parseA(rd *rdata.A, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.Addr, err = netip.ParseAddr(l.Token)
	if l.Value == dnslex.Error || err != nil || !rd.Addr.Is4() {
		return &ParseError{err: "bad A Addr", lex: l}
	}
	return toParseError(dnslex.Discard(c))
}

func parseAAAA(rd *rdata.AAAA, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.Addr, err = netip.ParseAddr(l.Token)
	if l.Value == dnslex.Error || err != nil || !rd.Addr.Is6() {
		return &ParseError{err: "bad AAAA Addr", lex: l}
	}
	return toParseError(dnslex.Discard(c))
}

func parsePX(rd *rdata.PX, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.Preference, err = dnsstring.AtoiUint16(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad PX Preference", lex: l}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.Map822 = dnsutilAbsolute(l.Token, o)
	if l.Value == dnslex.Error || rd.Map822 == "" {
		return &ParseError{err: "bad PX Map822", lex: l}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.Mapx400 = dnsutilAbsolute(l.Token, o)
	if l.Value == dnslex.Error || rd.Mapx400 == "" {
		return &ParseError{err: "bad PX Mapx400", lex: l}
	}
	return toParseError(dnslex.Discard(c))
}

func parseDS(rd *rdata.DS, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.KeyTag, err = dnsstring.AtoiUint16(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad DS KeyTag", lex: l}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.Algorithm, err = dnsstring.AtoiUint8(l.Token)
	if l.Value == dnslex.Error || err != nil {
		var ok bool
		rd.Algorithm, ok = upperLookup(l.Token, StringToAlgorithm)
		if !ok {
			return &ParseError{err: "bad DS Algorithm", lex: l}
		}
		return &ParseError{err: "bad DS Algorithm", lex: l}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.DigestType, err = dnsstring.AtoiUint8(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad DS DigestType", lex: l}
	}

	c.Next() // dnslex.Blank

	rd.Digest, err = remainder(c, "bad DS Digest")
	return err
}

func parseKX(rd *rdata.KX, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.Preference, err = dnsstring.AtoiUint16(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad KX Preference", lex: l}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.Exchanger = dnsutilAbsolute(l.Token, o)
	if l.Value == dnslex.Error || rd.Exchanger == "" {
		return &ParseError{err: "bad KX Exchanger", lex: l}
	}
	return toParseError(dnslex.Discard(c))
}

func parseTA(rd *rdata.TA, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.KeyTag, err = dnsstring.AtoiUint16(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad TA KeyTag", lex: l}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.Algorithm, err = dnsstring.AtoiUint8(l.Token)
	if l.Value == dnslex.Error || err != nil {
		var ok bool
		rd.Algorithm, ok = upperLookup(l.Token, StringToAlgorithm)
		if !ok {
			return &ParseError{err: "bad TA Algorithm", lex: l}
		}
		return &ParseError{err: "bad TA Algorithm", lex: l}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.DigestType, err = dnsstring.AtoiUint8(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad TA DigestType", lex: l}
	}

	c.Next() // dnslex.Blank

	rd.Digest, err = remainder(c, "bad TA Digest")
	return err
}

func parseTALINK(rd *rdata.TALINK, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.PreviousName = dnsutilAbsolute(l.Token, o)
	if l.Value == dnslex.Error || rd.PreviousName == "" {
		return &ParseError{err: "bad TALINK PreviousName", lex: l}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.NextName = dnsutilAbsolute(l.Token, o)
	if l.Value == dnslex.Error || rd.NextName == "" {
		return &ParseError{err: "bad TALINK NextName", lex: l}
	}
	return toParseError(dnslex.Discard(c))
}

func parseSSHFP(rd *rdata.SSHFP, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.Algorithm, err = dnsstring.AtoiUint8(l.Token)
	if l.Value == dnslex.Error || err != nil {
		var ok bool
		rd.Algorithm, ok = upperLookup(l.Token, StringToAlgorithm)
		if !ok {
			return &ParseError{err: "bad SSHFP Algorithm", lex: l}
		}
		return &ParseError{err: "bad SSHFP Algorithm", lex: l}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.Type, err = dnsstring.AtoiUint8(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad SSHFP Type", lex: l}
	}

	c.Next() // dnslex.Blank

	rd.FingerPrint, err = remainder(c, "bad SSHFP FingerPrint")
	return err
}

func parseDNSKEY(rd *rdata.DNSKEY, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.Flags, err = dnsstring.AtoiUint16(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad DNSKEY Flags", lex: l}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.Protocol, err = dnsstring.AtoiUint8(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad DNSKEY Protocol", lex: l}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.Algorithm, err = dnsstring.AtoiUint8(l.Token)
	if l.Value == dnslex.Error || err != nil {
		var ok bool
		rd.Algorithm, ok = upperLookup(l.Token, StringToAlgorithm)
		if !ok {
			return &ParseError{err: "bad DNSKEY Algorithm", lex: l}
		}
		return &ParseError{err: "bad DNSKEY Algorithm", lex: l}
	}

	c.Next() // dnslex.Blank

	rd.PublicKey, err = remainder(c, "bad DNSKEY PublicKey")
	return err
}

func parseRKEY(rd *rdata.RKEY, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.Flags, err = dnsstring.AtoiUint16(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad RKEY Flags", lex: l}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.Protocol, err = dnsstring.AtoiUint8(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad RKEY Protocol", lex: l}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.Algorithm, err = dnsstring.AtoiUint8(l.Token)
	if l.Value == dnslex.Error || err != nil {
		var ok bool
		rd.Algorithm, ok = upperLookup(l.Token, StringToAlgorithm)
		if !ok {
			return &ParseError{err: "bad RKEY Algorithm", lex: l}
		}
		return &ParseError{err: "bad RKEY Algorithm", lex: l}
	}

	c.Next() // dnslex.Blank

	rd.PublicKey, err = remainder(c, "bad RKEY PublicKey")
	return err
}

func parseNSAPPTR(rd *rdata.NSAPPTR, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.Ptr = dnsutilAbsolute(l.Token, o)
	if l.Value == dnslex.Error || rd.Ptr == "" {
		return &ParseError{err: "bad NSAPPTR Ptr", lex: l}
	}
	return toParseError(dnslex.Discard(c))
}

func parseDHCID(rd *rdata.DHCID, c *dnslex.Lexer, o string) (err error) {
	rd.Digest, err = remainder(c, "bad DHCID Digest")
	return err
}

func parseTLSA(rd *rdata.TLSA, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.Usage, err = dnsstring.AtoiUint8(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad TLSA Usage", lex: l}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.Selector, err = dnsstring.AtoiUint8(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad TLSA Selector", lex: l}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.MatchingType, err = dnsstring.AtoiUint8(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad TLSA MatchingType", lex: l}
	}

	c.Next() // dnslex.Blank

	rd.Certificate, err = remainder(c, "bad TLSA Certificate")
	return err
}

func parseSMIMEA(rd *rdata.SMIMEA, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.Usage, err = dnsstring.AtoiUint8(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad SMIMEA Usage", lex: l}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.Selector, err = dnsstring.AtoiUint8(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad SMIMEA Selector", lex: l}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.MatchingType, err = dnsstring.AtoiUint8(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad SMIMEA MatchingType", lex: l}
	}

	c.Next() // dnslex.Blank

	rd.Certificate, err = remainder(c, "bad SMIMEA Certificate")
	return err
}

func parseNID(rd *rdata.NID, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.Preference, err = dnsstring.AtoiUint16(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad NID Preference", lex: l}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.NodeID, err = dnsstring.ToNodeID(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad NID NodeID", lex: l}
	}
	return toParseError(dnslex.Discard(c))
}

func parseL32(rd *rdata.L32, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.Preference, err = dnsstring.AtoiUint16(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad L32 Preference", lex: l}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.Locator32, err = netip.ParseAddr(l.Token)
	if l.Value == dnslex.Error || err != nil || !rd.Locator32.Is4() {
		return &ParseError{err: "bad L32 Locator32", lex: l}
	}
	return toParseError(dnslex.Discard(c))
}

func parseL64(rd *rdata.L64, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.Preference, err = dnsstring.AtoiUint16(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad L64 Preference", lex: l}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.Locator64, err = dnsstring.ToNodeID(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad L64 Locator64", lex: l}
	}
	return toParseError(dnslex.Discard(c))
}

func parseLP(rd *rdata.LP, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.Preference, err = dnsstring.AtoiUint16(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad LP Preference", lex: l}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.Fqdn = dnsutilAbsolute(l.Token, o)
	if l.Value == dnslex.Error || rd.Fqdn == "" {
		return &ParseError{err: "bad LP Fqdn", lex: l}
	}
	return toParseError(dnslex.Discard(c))
}

func parseUID(rd *rdata.UID, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.Uid, err = dnsstring.AtoiUint32(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad UID Uid", lex: l}
	}
	return toParseError(dnslex.Discard(c))
}

func parseGID(rd *rdata.GID, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.Gid, err = dnsstring.AtoiUint32(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad GID Gid", lex: l}
	}
	return toParseError(dnslex.Discard(c))
}

func parseEID(rd *rdata.EID, c *dnslex.Lexer, o string) (err error) {
	rd.Endpoint, err = remainder(c, "bad EID Endpoint")
	return err
}

func parseNIMLOC(rd *rdata.NIMLOC, c *dnslex.Lexer, o string) (err error) {
	rd.Locator, err = remainder(c, "bad NIMLOC Locator")
	return err
}

func parseOPENPGPKEY(rd *rdata.OPENPGPKEY, c *dnslex.Lexer, o string) (err error) {
	rd.PublicKey, err = remainder(c, "bad OPENPGPKEY PublicKey")
	return err
}

func parseZONEMD(rd *rdata.ZONEMD, c *dnslex.Lexer, o string) (err error) {
	l, _ := c.Next()
	rd.Serial, err = dnsstring.AtoiUint32(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad ZONEMD Serial", lex: l}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.Scheme, err = dnsstring.AtoiUint8(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad ZONEMD Scheme", lex: l}
	}

	c.Next() // dnslex.Blank

	l, _ = c.Next()
	rd.Hash, err = dnsstring.AtoiUint8(l.Token)
	if l.Value == dnslex.Error || err != nil {
		return &ParseError{err: "bad ZONEMD Hash", lex: l}
	}

	c.Next() // dnslex.Blank

	rd.Digest, err = remainder(c, "bad ZONEMD Digest")
	return err
}
