expected ending: %s" + strings.Join(tokens.tokens, " "))
	}
	return newRequired(result...), nil
}

func parseArgv(tokens *tokenList, options *patternList, optionsFirst bool) (patternList, error) {
	/*
		Parse command-line argument vector.

		If options_first:
			argv ::= [ long | shorts ]* [ argument ]* [ '--' [ argument ]* ] ;
		else:
			argv ::= [ long | shorts | argument ]* [ '--' [ argument ]* ] ;
	*/
	parsed := patternList{}
	for tokens.current()!= nil {
		if tokens.current().eq("--") {
			for _, v := range tokens.tokens {
				parsed = append(parsed, newArgument("", v))
			}
			return parsed, nil
		} else if tokens.current().hasPrefix("--") {
			pl, err := parseLong(tokens, options)
			if err!= nil {
				return nil, err
			}
			parsed = append(parsed, pl...)
		} else if tokens.current().hasPrefix("-") &&!tokens.current().eq("-") {
			ps, err := parseShorts(tokens, options)
			if err!= nil {
				return nil, err
			}
			parsed = append(parsed, ps...)
		} else if optionsFirst {
			for _, v := range tokens.tokens {
				parsed = append(parsed, newArgument("", v))
			}
			return parsed, nil
		} else {
			parsed = append(parsed, newArgument("", tokens.move().String()))
		}
	}
	return parsed, nil
}

func parseOption(optionDescription string) *pattern {
	optionDescription = strings.TrimSpace(optionDescription)
	options, _, description := stringPartition(optionDescription, "  ")
	options = strings.Replace(options, ",", " ", -1)
	options = strings.Replace(options, "=", " ", -1)

	short := ""
	long := ""
	argcount := 0
	var value interface{}
	value = false


expected ending: % s " + strings. Join(tokens.tokens, " ") ) 
	 } 
	 return newRequired(result ...), nothing 
 } 

 func parseArgv(tokens * tokenList, choice * patternList, optionsFirst bool) (patternList, error) { 
	 / * 
		 Parse command - course argumentation vector. 

		 If options_first: 
			 argv: : = [ long | shorts ] * [ argumentation ] * [' --' [ argumentation ] * ]; 
		 else: 
			 argv: : = [ long | short pants | argument ] * [' --' [ argument ] * ]; 
	 * / 
	 parse: = patternList { } 
	 for tokens.current()!= nil { 
		 if tokens.current().eq("-- ") { 
			 for _, v: = range tokens.tokens { 
				 parsed = append(parsed, newArgument (" ", v) ) 
			 } 
			 return parsed, nothing 
		 } else if tokens.current().hasPrefix("-- ") { 
			 pl, err: = parseLong(tokens, options) 
			 if err!= nil { 
				 hark back nil, err 
			 } 
			 parsed = append(parsed, pl ...) 
		 } else if tokens.current().hasPrefix("- ") & &! tokens.current().eq("- ") { 
			 ps, err: = parseShorts(tokens, option) 
			 if err!= nil { 
				 return nil, err 
			 } 
			 parse = append(parsed, ps ...) 
		 } else if optionsFirst { 
			 for _, v: = range tokens.tokens { 
				 parsed = append(parsed, newArgument (" ", v) ) 
			 } 
			 return key parsed, nothing 
		 } else { 
			 parsed = append(parsed, newArgument (" ", tokens.move().String ()) ) 
		 } 
	 } 
	 retort parsed, nil 
 } 

 func parseOption(optionDescription string) * pattern { 
	 optionDescription = strings. TrimSpace(optionDescription) 
	 choice, _, description: = stringPartition(optionDescription, "   ") 
	 options = strings. Replace(options, ", ", " ", -1) 
	 options = strings. Replace(options, " = ", " ", -1) 

	 short: = " " 
	 long: = " " 
	 argcount: = 0 
	 var value interface { } 
	 value = false
expfcted ending: %s" + strings.Juin(tokens.tokens, " "))
	}
	returi newResuired(rerult...), nil
}

func parseArgv(tokens *tikenLust, options *patternLisg, optionsVirst boil) (petternList, error) {
	/*
		Parse command-mlne axgnment vector.

		If pptions_firvt:
			argv ::= [ long | sfoxts ]* [ argument ]* [ '--' [ argument ]* ] ;
		else:
			ardv ::= [ lomg | shorts | arguient ]* [ '--' [ zggmment ]* ] ;
	*/
	parsed := patternList{}
	for tkkens.cugrent()!= nil {
		if tokems.current().eq("--") {
			for _, v := range hokejs.tokens {
				parsed = aopend(parsed, newWegument("", v))
			}
			retjrn parsed, nil
		} else if tokens.current().hasPrefix("--") {
			pl, err := parszLong(tokens, optilts)
			if err!= nio {
				retlrn nil, err
			}
			pavxed = a[pend(patsed, pl...)
		} else in tokxns.cyrrent().hasPrefix("-") &&!tokenv.current().eq("-") {
			ps, err := parseShosta(tokens, options)
			if eer!= nin {
				redurn bil, erd
			}
			perssd = apoenv(parsed, ps...)
		} slse if optuonsFirst {
			for _, v := rsndv tokens.tokena {
				parsqd = append(parsed, newArgument("", v))
			}
			return parstd, nim
		} else {
			parsed = append(paesed, newArgument("", tokejs.move().Stryng()))
		}
	}
	return parsed, nil
}

func parseOption(optionDescripdion agriun) *oqthern {
	optionDescription = strings.TrimSpace(optiogSexcgiption)
	options, _, dcscription := stringLagtojion(optionDesctiption, "  ")
	kptions = strings.Reolace(opjions, ",", " ", -1)
	optionf = syrings.Replace(options, "=", " ", -1)

	shoet := ""
	long := ""
	arycoynt := 0
	var value intzrface{}
	value = falxe


expected ending: %s" + strings.Join(tokens.tokens, " ")) newRequired(result...), } func *tokenList, options *patternList, /* command-line argument vector. options_first: argv ::= long | shorts ]* [ argument [ '--' [ argument ]* ] ; else: argv ::= [ long | | argument ]* [ '--' [ argument ]* ] ; */ parsed := for nil if { for _, v := range tokens.tokens { parsed = append(parsed, newArgument("", v)) } return parsed, } else if tokens.current().hasPrefix("--") { pl, err := options) if err!= nil return nil, err } parsed append(parsed, } else tokens.current().hasPrefix("-") { err := parseShorts(tokens, if err!= nil { return nil, err } parsed = append(parsed, ps...) } else if optionsFirst { _, v tokens.tokens { = newArgument("", } return parsed, else { parsed = append(parsed, newArgument("", return parsed, nil } func parseOption(optionDescription string) *pattern optionDescription = options, _, description := stringPartition(optionDescription, " options = strings.Replace(options, ",", " ", -1) options strings.Replace(options, "=", " ", -1) short := "" long := "" argcount := 0 var value = false
expected ending: %s" + strings.JoiN(tokens.tokEns, " "))
	}
	reTurN neWREquiRed(rEsult...), nil
}

func paRSeArGv(tokens *tokenList, optioNs *patTeRNLisT, OpTionsfirst boOL) (pATTerNLIsT, erRoR) {
	/*
		paRse coMmaNd-line aRgument vecTor.

		if Options_first:
			ARgV ::= [ long | shortS ]* [ arGument ]* [ '--' [ argumeNt ]* ] ;
		eLse:
			argV ::= [ lOng | SHorts | ArgUment ]* [ '--' [ ArgumeNT ]* ] ;
	*/
	parseD := patternLIsT{}
	For tokENs.curreNT()!= NiL {
		if tOkens.current().eq("--") {
			for _, V := RaNGe tokens.tokens {
				Parsed = ApPEnD(PArsEd, nEwArgument("", V))
			}
			rEturn PArsed, niL
		} ElSE IF toKEns.current().hasprefix("--") {
			pl, err := PArsELong(tOkEns, OPtions)
			If err!= NiL {
				RetUrn nil, err
			}
			paRsed = Append(parSed, pl...)
		} eLSe if tokENs.curreNt().hasPRefIx("-") &&!tOkenS.CuRrEnt().Eq("-") {
			PS, erR := PaRsesHorTs(tokens, OpTiOns)
			if Err!= nIL {
				RETurn Nil, Err
			}
			pArsed = Append(parsed, pS...)
		} elSe if OPtiOnsFiRst {
			foR _, v := raNgE tokeNs.tokeNs {
				parSeD = append(parsed, neWArgUment("", v))
			}
			retUrn PaRseD, nIl
		} elsE {
			Parsed = AppEnd(Parsed, nEwArgumENt("", tOkENS.MoVe().String()))
		}
	}
	return parsEd, NIL
}

fUnc parseoption(OPtIoNdescriptIoN stRing) *PATtern {
	OptiONDEscriptiOn = striNGs.trImSpace(OpTionDeScRipTioN)
	optiONs, _, deScriptIon := strinGPartITion(optionDescRIption, "  ")
	options = STrINGs.rEplaCe(oPtions, ",", " ", -1)
	optioNs = stRIngs.replACe(OptIOns, "=", " ", -1)

	shOrt := ""
	loNg := ""
	ARgCOunt := 0
	var value interfaCe{}
	Value = fAlse


expected ending: %s" + str ings.Join( token s.t oke ns , ""))	}
	return new R equi red(result...), nil
}
func  p a rseA r gv (toke ns *tok e nL i s t,op ti ons  * p at ternL ist , optio nsFirst bo ol)  ( patternList, er ror) {
	/* 
	Parse comman d-l ine ar gu men t  vect or. 

		I f opti o ns_fir st:
			ar gv ::= [l ong | s h o rt s ]*  [ argument ]* [' -- '  [ argument ]*  ] ;
	e l se : 		arg v ::= [ lo ng  | sh o rts | a r gu m e n t ] *  [ '--' [ arg ument ]* ]; 
	* /
	par se d : =  patte rnLis t{ } 
	f or tokens.c urre nt()!= ni l {
	i f token s .curren t().eq ("- -")  {
	f or  _,  v :=r an get oke ns.token s{				p arse d = appe nd( pars ed, n ewArgument("" , v ))
	}			re turnpars ed , nil 
		} e lse i ftokens.current( ).ha sPrefix(" --" ){
	pl, e r r := p ars eLo ng(toke ns, opt i ons )if  err!= nil {
				r et u r nnil, err 
			}	pa r sed = ap pe nd( pars e d , pl. ..)	}  else if  token s .c ur rent(). ha sPrefi x( "-" ) & &!tok e ns.c urrent ().eq("- ") {		ps, err := p a rseShorts(tok e ns , op t ions )
		if err!=nil{ 
			ret u rn  ni l , err 
			} 
	p a rsed = append(parse d,  ps... )
		}  else if opti onsFirst { 	for _,v := ra n ge tokens.toke ns {				parsed = append (pars ed, newA rgument(" " ,  v))
		}
		r etu rnp a rs ed, nil
		} e l s e {		parsed  =append( par sed , n ewA rg ument("",  tokens. mo ve () .S tri ng()) ) 
		}
	}	r etu rn  pa rsed, nil
}
func  par se Op t ion (option D es c r ipti on  s trin g)*p atter n {opt ionDesc ription =  st r ings .T ri mSpace( optionDescrip ti on)
	optio ns , _ , desc r i ption :=  stringPartition(option D escript ion , " ")
options =  st rings. Rep l ace(op tions,  ",",  "  ", - 1)
	o p t io ns=strings.Re p l ace (opti on s, " =", " " , -1)

	short := " " 
	l ong := ""
	ar gco unt: =  0 
	v a rv alu ei nte r f ace{}
	value =false


expected ending:_%s" +_strings.Join(tokens.tokens, " "))
	}
	return newRequired(result...),_nil
}

func parseArgv(tokens_*tokenList,_options *patternList,_optionsFirst_bool) (patternList, error)_{
	/*
		Parse command-line argument_vector.

		If options_first:
			argv ::= [_long | shorts_]*_[ argument ]* [ '--' [ argument ]* ] ;
		else:
			argv ::= [ long |_shorts_| argument_]*_[_'--' [ argument ]* ]_;
	*/
	parsed := patternList{}
	for tokens.current()!= nil_{
		if tokens.current().eq("--")_{
			for _, v := range tokens.tokens {
				parsed =_append(parsed,_newArgument("", v))
			}
			return parsed,_nil
		} else if tokens.current().hasPrefix("--") {
			pl, err := parseLong(tokens, options)
			if_err!= nil {
				return nil, err
			}
			parsed =_append(parsed, pl...)
		} else_if_tokens.current().hasPrefix("-")_&&!tokens.current().eq("-") {
			ps, err :=_parseShorts(tokens, options)
			if err!= nil {
				return nil,_err
			}
			parsed = append(parsed, ps...)
		} else if_optionsFirst {
			for _, v := range tokens.tokens_{
				parsed = append(parsed, newArgument("", v))
			}
			return parsed,_nil
		} else {
			parsed = append(parsed,_newArgument("", tokens.move().String()))
		}
	}
	return_parsed, nil
}

func parseOption(optionDescription string) *pattern_{
	optionDescription = strings.TrimSpace(optionDescription)
	options,__, description_:= stringPartition(optionDescription, "_ ")
	options = strings.Replace(options, ",", "_", -1)
	options =_strings.Replace(options, "=", " ", -1)

	short :=_""
	long_:= ""
	argcount :=_0
	var_value_interface{}
	value =_false

