{{/* SPDX-License-Identifier: Unlicense */ -}} {{define "func"}}{{if gt . 1 -}} func Seq{{.}}[In, Out{{range .Count}}, T{{.}}{{end}} any]( {{- range .Count}} p{{.}} Parser[In, T{{.}}],{{end}} f func({{range .Count}}{{if ne . 1}}, {{end}}T{{.}}{{end}}) Out, ) Parser[In, Out] { return func(s State[In]) (Result[In, Out], error) { var anyConsumed bool var next = s {{range .Count}} r{{.}}, err := p{{.}}(next) if err != nil { return Result[In, Out]{}, err } anyConsumed = anyConsumed || r{{.}}.Consumed() success, val{{.}}, next := r{{.}}.Status() if !success { return Fail[In, Out](anyConsumed, r{{.}}.Message()), nil } {{end}} final := f({{range .Count}}{{if ne . 1}}, {{end}}val{{.}}{{end}}) return Succeed(anyConsumed, final, next, MessageOK(s.Pos())), nil } }{{end}}{{end -}} // GENERATED FILE. DO NOT EDIT. // SPDX-License-Identifier: Unlicense package {{.Package}} {{range .Count}}{{template "func" .}} {{end}}