2024-10-17 22:02:29 +00:00
|
|
|
// SPDX-License-Identifier: Unlicense
|
|
|
|
|
2024-10-17 22:01:27 +00:00
|
|
|
package gigaparsec
|
|
|
|
|
|
|
|
func Bind2Naïve[In, Out, T, T2 any](
|
|
|
|
p Parser[In, T],
|
|
|
|
f func(T) Parser[In, T2],
|
|
|
|
f2 func(T2) Parser[In, Out],
|
|
|
|
) Parser[In, Out] {
|
|
|
|
return Bind(Bind(p, f), f2)
|
|
|
|
}
|
|
|
|
func Bind3Naïve[In, Out, T, T2, T3, T4, T5, T6, T7, T8, T9 any](
|
|
|
|
p Parser[In, T],
|
|
|
|
f func(T) Parser[In, T2],
|
|
|
|
f2 func(T2) Parser[In, T3],
|
|
|
|
f3 func(T3) Parser[In, Out],
|
|
|
|
) Parser[In, Out] {
|
|
|
|
return Bind(Bind(Bind(p, f), f2), f3)
|
|
|
|
}
|
|
|
|
func Bind4Naïve[In, Out, T, T2, T3, T4 any](
|
|
|
|
p Parser[In, T],
|
|
|
|
f func(T) Parser[In, T2],
|
|
|
|
f2 func(T2) Parser[In, T3],
|
|
|
|
f3 func(T3) Parser[In, T4],
|
|
|
|
f4 func(T4) Parser[In, Out],
|
|
|
|
) Parser[In, Out] {
|
|
|
|
return Bind(Bind(Bind(Bind(p, f), f2), f3), f4)
|
|
|
|
}
|
|
|
|
func Bind5Naïve[In, Out, T, T2, T3, T4, T5 any](
|
|
|
|
p Parser[In, T],
|
|
|
|
f func(T) Parser[In, T2],
|
|
|
|
f2 func(T2) Parser[In, T3],
|
|
|
|
f3 func(T3) Parser[In, T4],
|
|
|
|
f4 func(T4) Parser[In, T5],
|
|
|
|
f5 func(T5) Parser[In, Out],
|
|
|
|
) Parser[In, Out] {
|
|
|
|
return Bind(Bind(Bind(Bind(Bind(p, f), f2), f3), f4), f5)
|
|
|
|
}
|
|
|
|
func Bind6Naïve[In, Out, T, T2, T3, T4, T5, T6 any](
|
|
|
|
p Parser[In, T],
|
|
|
|
f func(T) Parser[In, T2],
|
|
|
|
f2 func(T2) Parser[In, T3],
|
|
|
|
f3 func(T3) Parser[In, T4],
|
|
|
|
f4 func(T4) Parser[In, T5],
|
|
|
|
f5 func(T5) Parser[In, T6],
|
|
|
|
f6 func(T6) Parser[In, Out],
|
|
|
|
) Parser[In, Out] {
|
|
|
|
return Bind(Bind(Bind(Bind(Bind(Bind(p, f), f2), f3), f4), f5), f6)
|
|
|
|
}
|
|
|
|
func Bind7Naïve[In, Out, T, T2, T3, T4, T5, T6, T7 any](
|
|
|
|
p Parser[In, T],
|
|
|
|
f func(T) Parser[In, T2],
|
|
|
|
f2 func(T2) Parser[In, T3],
|
|
|
|
f3 func(T3) Parser[In, T4],
|
|
|
|
f4 func(T4) Parser[In, T5],
|
|
|
|
f5 func(T5) Parser[In, T6],
|
|
|
|
f6 func(T6) Parser[In, T7],
|
|
|
|
f7 func(T7) Parser[In, Out],
|
|
|
|
) Parser[In, Out] {
|
|
|
|
return Bind(Bind(Bind(Bind(Bind(Bind(Bind(p, f), f2), f3), f4), f5), f6), f7)
|
|
|
|
}
|
|
|
|
func Bind8Naïve[In, Out, T, T2, T3, T4, T5, T6, T7, T8 any](
|
|
|
|
p Parser[In, T],
|
|
|
|
f func(T) Parser[In, T2],
|
|
|
|
f2 func(T2) Parser[In, T3],
|
|
|
|
f3 func(T3) Parser[In, T4],
|
|
|
|
f4 func(T4) Parser[In, T5],
|
|
|
|
f5 func(T5) Parser[In, T6],
|
|
|
|
f6 func(T6) Parser[In, T7],
|
|
|
|
f7 func(T7) Parser[In, T8],
|
|
|
|
f8 func(T8) Parser[In, Out],
|
|
|
|
) Parser[In, Out] {
|
|
|
|
return Bind(Bind(Bind(Bind(Bind(Bind(Bind(Bind(p, f), f2), f3), f4), f5), f6), f7), f8)
|
|
|
|
}
|
|
|
|
func Bind9Naïve[In, Out, T, T2, T3, T4, T5, T6, T7, T8, T9 any](
|
|
|
|
p Parser[In, T],
|
|
|
|
f func(T) Parser[In, T2],
|
|
|
|
f2 func(T2) Parser[In, T3],
|
|
|
|
f3 func(T3) Parser[In, T4],
|
|
|
|
f4 func(T4) Parser[In, T5],
|
|
|
|
f5 func(T5) Parser[In, T6],
|
|
|
|
f6 func(T6) Parser[In, T7],
|
|
|
|
f7 func(T7) Parser[In, T8],
|
|
|
|
f8 func(T8) Parser[In, T9],
|
|
|
|
f9 func(T9) Parser[In, Out],
|
|
|
|
) Parser[In, Out] {
|
|
|
|
return Bind(Bind(Bind(Bind(Bind(Bind(Bind(Bind(Bind(p, f), f2), f3), f4), f5), f6), f7), f8), f9)
|
|
|
|
}
|