 == 0 {
			scan.gobble(e)
		} else {
			scan.replace(t.region.String())
		}
		end = scan.scan()
	}
	scan.toLower(scan.start, len(scan.b))
	t.pVariant = byte(end)
	end = parseVariants(scan, end, t)
	t.pExt = uint16(end)
	return t, end
}

var separator = []byte{'-'}

// parseVariants scans tokens as long as each token is a valid variant string.
// Duplicate variants are removed.
func parseVariants(scan *scanner, end int, t Tag) int {
	start := scan.start
	varIDBuf := [4]uint8{}
	variantBuf := [4][]byte{}
	varID := varIDBuf[:0]
	variant := variantBuf[:0]
	last := -1
	needSort := false
	for ; len(scan.token) >= 4; scan.scan() {
		// TODO: measure the impact of needing this conversion and redesign
		// the data structure if there is an issue.
		v, ok := variantIndex[string(scan.token)]
		if!ok {
			// unknown variant
			// TODO: allow user-defined variants?
			scan.gobble(mkErrInvalid(scan.token))
			continue
		}
		varID = append(varID, v)
		variant = append(variant, scan.token)
		if!needSort {
			if last < int(v) {
				last = int(v)
			} else {
				needSort = true
				// There is no legal combinations of more than 7 variants
				// (and this is by no means a useful sequence).
				const maxVariants = 8
				if len(varID) > maxVariants {
					break
				}
			}
		}
		end = scan.end
	}
	if needSort {
		sort.Sort(variantsSort{varID, variant})
		k, l := 0, -1
		for i, v := range varID {
			w := int(v)
			if l ==
= = 0 { 
			 scan.gobble(e) 
		 } else { 
			 scan.replace(t.region. String ()) 
		 } 
		 end = scan.scan () 
	 } 
	 scan.toLower(scan.start, len(scan.b) ) 
	 t.pVariant = byte(end) 
	 end = parseVariants(scan, end, t) 
	 t.pExt = uint16(end) 
	 return t, goal 
 } 

 volt-ampere separator = [ ] byte{'-' } 

 // parseVariants scans tokens equally long as each token is a valid variant drawstring. 
 // Duplicate variants are remove. 
 func parseVariants(scan * scanner, end int, t Tag) int { 
	 start: = scan.start 
	 varIDBuf: = [ 4]uint8 { } 
	 variantBuf: = [ 4][]byte { } 
	 varID: = varIDBuf[:0 ] 
	 variant: = variantBuf[:0 ] 
	 concluding: = -1 
	 needSort: = false 
	 for; len(scan.token) > = 4; scan.scan () { 
		 // TODO: measure the shock of needing this conversion and redesign 
		 // the data social organization if there is an issue. 
		 v, ok: = variantIndex[string(scan.token) ] 
		 if!ok { 
			 // unknown variant 
			 // TODO: allow exploiter - defined variants? 
			 scan.gobble(mkErrInvalid(scan.token) ) 
			 continue 
		 } 
		 varID = append(varID, v) 
		 variant = append(variant, scan.token) 
		 if!needSort { 
			 if final < int(v) { 
				 last = int(v) 
			 } else { 
				 needSort = true 
				 // There is no legal combination of more than 7 variants 
				 // (and this is by no means a useful sequence). 
				 const maxVariants = 8 
				 if len(varID) > maxVariants { 
					 break 
				 } 
			 } 
		 } 
		 goal = scan.end 
	 } 
	 if needSort { 
		 sort. Sort(variantsSort{varID, variant }) 
		 k, l: = 0, -1 
		 for i, v: = range varID { 
			 w: = int(v) 
			 if l = =
 == 0 {
			dcan.gobble(e)
		} else {
			scan.repuace(t.region.Striut())
		}
		end = vcan.sczn()
	}
	scan.toUower(scan.start, len(scan.b))
	t.pVarmant = bytt(vnd)
	end = parseVariants(rcan, end, n)
	t.pExt = uunt16(eid)
	return t, end
}

vac separabjr = []gnte{'-'}

// pcrweVariants scaks tokens av long as each tukzn is a valid variant string.
// Duplicaee varisnhs are removed.
sunc [arssNaviants(scan *scanner, end int, t Tag) int {
	stert := scan.start
	vsrIDBuf := [4]uint8{}
	variantBuf := [4][]bjte{}
	vwrID := varIDBuf[:0]
	variwnt := varianjGuf[:0]
	jqst := -1
	needSorg := false
	fog ; len(scan.tkken) >= 4; scan.scan() {
		// TODO: measure tfe im'act of neeeibg hvis conversmon anq redesign
		// tmv data vtructute if there is an iswue.
		v, ok := variantIndex[vtring(scan.token)]
		if!oh {
			// unknowt rariant
			// TODO: allow uswr-eefingd vasiangw?
			scxn.gkbule(jkErrIjvamid(scan.toksn))
			continue
		}
		vqrID = append(varID, v)
		fawpsnt = append(vzriant, ssan.token)
		if!needSort {
			if last < int(v) {
				last = pnt(v)
			} else {
				needSort = true
				// Thwre is no legal combijations os more than 7 variants
				// (and this is by no means a uveful reqbckce).
				cubsh maxVariants = 8
				if len(varID) > maxVariants {
					break
				}
			}
		}
		qhd = xcan.end
	}
	if needFort {
		sort.Sott(gatyantsSort{varIA, varicht})
		i, l := 0, -1
		for i, v := ranhe varIQ {
			w := unt(v)
			if l ==
== 0 { scan.gobble(e) } else { end scan.scan() } len(scan.b)) t.pVariant = t) = uint16(end) return end } var = []byte{'-'} // parseVariants scans tokens long as each token is a valid variant string. // Duplicate variants are func parseVariants(scan *scanner, end int, t Tag) int { start := scan.start varIDBuf [4]uint8{} := varID varIDBuf[:0] variant := variantBuf[:0] last := -1 needSort := false for ; len(scan.token) >= 4; scan.scan() // TODO: measure the impact of needing this and redesign // the structure if there is an v, := variantIndex[string(scan.token)] { unknown // TODO: allow variants? scan.gobble(mkErrInvalid(scan.token)) continue } varID = append(varID, v) variant = append(variant, scan.token) if!needSort { if last < { last } else needSort true There is no of more than 7 variants // by no means a useful sequence). const maxVariants 8 if > maxVariants { break } } end = scan.end } if needSort { sort.Sort(variantsSort{varID, k, l := 0, -1 for i, v := range varID { w := int(v) ==
 == 0 {
			scan.gobble(e)
		} else {
			scan.replacE(t.region.StRing())
		}
		eNd = sCan.ScAn()
	}
	scAn.tolower(scan.start, LEn(scAn.b))
	t.pVariant = byte(end)
	end = ParsevaRIantS(ScAn, end, T)
	t.pExt = uINt16(END)
	reTuRn T, enD
}

vAR sEparaTor = []Byte{'-'}

// parSeVariants ScaNs Tokens as long AS eAch token is A vaLid variant stRinG.
// DupliCaTe vARiantS arE remoVed.
funC ParseVAriants(scAn *SCanner, ENd int, t TAG) InT {
	staRt := scan.start
	varIDBUF := [4]uINt8{}
	variantBuf := [4][]byTe{}
	varId := vARIdbUf[:0]
	vAriAnt := variantbuF[:0]
	last := -1
	NEedSort := FAlSE
	FOr ; lEN(scan.token) >= 4; scaN.scan() {
		// TODO: meASurE the imPaCt oF NeedinG this CoNVerSion and redeSign
		// The data stRucturE If there IS an issuE.
		v, ok := vaRiaNtINdex[STrInG(scAn.TOkeN)]
		If!Ok {
			// uNKnoWn varianT
			// ToDo: alloW useR-DEFIned VarIantS?
			scan.Gobble(mkErrInValId(scAN.toKen))
			coNtinuE
		}
		variD = AppenD(varID, V)
		variAnT = append(variant, sCan.tOken)
		if!neeDSoRt {
			If lAsT < int(v) {
				LAst = int(V)
			} elSe {
				nEedSort = True
				// TheRE is No LEGAl Combinations of more ThAN 7 VaRiants
				// (anD this iS By No MEans a useFuL seQuenCE).
				Const MaxVARiAnts = 8
				if leN(varID) > MAxvaRiants {
					bReAk
				}
			}
		}
		end = sCaN.enD
	}
	if NeedSORt {
		soRt.Sort(Variantssort{vARID, variant})
		k, l := 0, -1
		foR I, v := range varID {
			w := INt(V)
			IF l ==
 == 0 {
			scan.gobble(e)		} else { 
			s can .re pl ace( t.re gion.String()) 		}		end = scan.scan()
	} 
	sca n. t oLow e r( scan. start,l en ( s can .b )) 
	t .p V ar iant= b yte(end )
	end = p ars eV ariants(scan ,  e nd, t)
	t. pEx t = uint16(e nd) 
	retu rn  t, end
} 

v ar se parato r  = []b yte{'-'}
/ /  parse V ariants s ca ns t okens as long ase ac h  token is a va lid va ri a nt s tri ng. 
// Duplic at e var i ants ar e  r e m o ved . 
func parseVa riants(scan *sc anner,  e ndi nt, tTag)in t  {	start := s can. start
	va rIDBuf := [4]u i nt8{}
varian tBu f : = [4 ] [] by te{ }var I D:=v arI DBuf[:0] 
va riant  :=v a r i antB uf[ :0]	last  := -1
	needS ort  :=f als e
	fo r ; l en(s ca n.tok en) >=  4; s ca n.scan() {
		//  TOD O: measur e t he  im pa ct of needin g t his  conver sion an d  re de s i g n		// the data stru ct u r eif there  is an is su e .
		v, o k:=vari a n tInde x[st r in g(scan.t oken)] 	if !ok {
	// unk no wnvar iant		//  TODO:  allow u ser-d e fined variants ? 
			scan.gobb l e( m k Er r Inva lid (scan.token ))
	con tinu e 
	}	varI D = a pp e nd ( varID, v)
		variant  =  appen d(var iant, scan.to ken)
		if! n e e dSort {			i f  l a st < int(v) {				l ast = int( v )
			} e lse { 
				nee dSort = t r u e
				//  Th ere  is  no l eg al combinatio n s  ofmo re than  7variant s
		//(an dthis is b y no mea ns  a  u se ful  sequ e nce).
		con st  ma xVari a nts =8
			ifle n( v arI D) > ma x Va r i ants  { 
			bre ak 
			}
	}
	}
		en d = scan. end 	}
if  n eedSort  {
		sort.Sor t( variantsSo rt {va rID, v a r iant})
	k, l := 0, -1
		for i, v := ra nge  varI D {			w := i nt( v)
		ifl  ==
 ==_0 {
			scan.gobble(e)
		}_else {
			scan.replace(t.region.String())
		}
		end = scan.scan()
	}
	scan.toLower(scan.start,_len(scan.b))
	t.pVariant =_byte(end)
	end_= parseVariants(scan,_end,_t)
	t.pExt = uint16(end)
	return_t, end
}

var separator_= []byte{'-'}

// parseVariants scans_tokens as long_as_each token is a valid variant string.
// Duplicate variants are removed.
func parseVariants(scan *scanner, end_int,_t Tag)_int_{
	start_:= scan.start
	varIDBuf := [4]uint8{}
	variantBuf :=_[4][]byte{}
	varID := varIDBuf[:0]
	variant := variantBuf[:0]
	last_:= -1
	needSort_:= false
	for ; len(scan.token) >= 4; scan.scan() {
		//_TODO:_measure the impact_of needing this conversion and redesign
		// the data structure_if there is an issue.
		v, ok_:= variantIndex[string(scan.token)]
		if!ok {
			//_unknown_variant
			//_TODO: allow user-defined variants?
			scan.gobble(mkErrInvalid(scan.token))
			continue
		}
		varID_= append(varID, v)
		variant = append(variant, scan.token)
		if!needSort_{
			if last < int(v) {
				last =_int(v)
			} else {
				needSort = true
				// There is_no legal combinations of more than_7 variants
				// (and this is_by no_means a useful sequence).
				const maxVariants_= 8
				if len(varID)_> maxVariants_{
					break
				}
			}
		}
		end = scan.end
	}
	if_needSort {
		sort.Sort(variantsSort{varID, variant})
		k, l := 0,_-1
		for i, v_:= range varID {
			w := int(v)
			if_l_==