diff --git a/TODO.txt b/TODO.txt index 826e5e1..78ee180 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,6 +1,5 @@ Think about not requiring so much Pos() when making messages Think about changing "consume" to "commit" -Document Seq Should MakeState be private now that there's Run? What's Megaparsec got that we ain't got? chainl diff --git a/internal/bindgen/seq.go.tmpl b/internal/bindgen/seq.go.tmpl index c58425f..37a175a 100644 --- a/internal/bindgen/seq.go.tmpl +++ b/internal/bindgen/seq.go.tmpl @@ -1,6 +1,7 @@ {{/* SPDX-License-Identifier: Unlicense */ -}} {{define "func"}}{{if gt . 1 -}} +// Seq{{if gt . 2}}{{.}}{{end}} runs {{.}} parsers in sequence and maps their collected results with f. func Seq{{if gt . 2}}{{.}}{{end}}[In, Out{{range .Count}}, T{{.}}{{end}} any]( {{- range .Count}} p{{.}} Parser[In, T{{.}}],{{end}} diff --git a/seq.go b/seq.go index f63496c..7c05398 100644 --- a/seq.go +++ b/seq.go @@ -4,6 +4,7 @@ package gigaparsec +// Seq runs 2 parsers in sequence and maps their collected results with f. func Seq[In, Out, T, T2 any]( p Parser[In, T], p2 Parser[In, T2], @@ -38,6 +39,7 @@ func Seq[In, Out, T, T2 any]( } } +// Seq3 runs 3 parsers in sequence and maps their collected results with f. func Seq3[In, Out, T, T2, T3 any]( p Parser[In, T], p2 Parser[In, T2], @@ -83,6 +85,7 @@ func Seq3[In, Out, T, T2, T3 any]( } } +// Seq4 runs 4 parsers in sequence and maps their collected results with f. func Seq4[In, Out, T, T2, T3, T4 any]( p Parser[In, T], p2 Parser[In, T2], @@ -139,6 +142,7 @@ func Seq4[In, Out, T, T2, T3, T4 any]( } } +// Seq5 runs 5 parsers in sequence and maps their collected results with f. func Seq5[In, Out, T, T2, T3, T4, T5 any]( p Parser[In, T], p2 Parser[In, T2], @@ -206,6 +210,7 @@ func Seq5[In, Out, T, T2, T3, T4, T5 any]( } } +// Seq6 runs 6 parsers in sequence and maps their collected results with f. func Seq6[In, Out, T, T2, T3, T4, T5, T6 any]( p Parser[In, T], p2 Parser[In, T2], @@ -284,6 +289,7 @@ func Seq6[In, Out, T, T2, T3, T4, T5, T6 any]( } } +// Seq7 runs 7 parsers in sequence and maps their collected results with f. func Seq7[In, Out, T, T2, T3, T4, T5, T6, T7 any]( p Parser[In, T], p2 Parser[In, T2], @@ -373,6 +379,7 @@ func Seq7[In, Out, T, T2, T3, T4, T5, T6, T7 any]( } } +// Seq8 runs 8 parsers in sequence and maps their collected results with f. func Seq8[In, Out, T, T2, T3, T4, T5, T6, T7, T8 any]( p Parser[In, T], p2 Parser[In, T2], @@ -473,6 +480,7 @@ func Seq8[In, Out, T, T2, T3, T4, T5, T6, T7, T8 any]( } } +// Seq9 runs 9 parsers in sequence and maps their collected results with f. func Seq9[In, Out, T, T2, T3, T4, T5, T6, T7, T8, T9 any]( p Parser[In, T], p2 Parser[In, T2],