Documentation ¶
Index ¶
- func Pipe[In, Ignore, Through any](p Parser[In, Ignore]) func(Through) Parser[In, Through]
- func Run[In, Out any](p Parser[In, Out], r ReaderAt[In]) (out Out, err error)
- type Message
- type ParseError
- type Parser
- func Bind[In, Out, T any](p Parser[In, T], f func(T) Parser[In, Out]) Parser[In, Out]
- func Bind2[In, Out, T, T2 any](p Parser[In, T], f func(T) Parser[In, T2], f2 func(T2) Parser[In, Out]) Parser[In, Out]
- 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]
- func Bind3[In, Out, T, T2, T3 any](p Parser[In, T], f func(T) Parser[In, T2], f2 func(T2) Parser[In, T3], ...) Parser[In, Out]
- 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], ...) Parser[In, Out]
- func Bind4[In, Out, T, T2, T3, T4 any](p Parser[In, T], f func(T) Parser[In, T2], f2 func(T2) Parser[In, T3], ...) Parser[In, Out]
- 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], ...) Parser[In, Out]
- func Bind5[In, Out, T, T2, T3, T4, T5 any](p Parser[In, T], f func(T) Parser[In, T2], f2 func(T2) Parser[In, T3], ...) Parser[In, Out]
- 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], ...) Parser[In, Out]
- func Bind6[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], ...) Parser[In, Out]
- 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], ...) Parser[In, Out]
- func Bind7[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], ...) Parser[In, Out]
- 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], ...) Parser[In, Out]
- func Bind8[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], ...) Parser[In, Out]
- 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], ...) Parser[In, Out]
- func Bind9[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], ...) Parser[In, Out]
- 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], ...) Parser[In, Out]
- func Choose[In, Out any](p Parser[In, Out], ps ...Parser[In, Out]) Parser[In, Out]
- func End[In any]() Parser[In, struct{}]
- func Map[In, Out1, Out2 any](p Parser[In, Out1], f func(Out1) Out2) Parser[In, Out2]
- func Match[T comparable](x T) Parser[T, T]
- func MatchSlice[T comparable](s []T) Parser[T, []T]
- func Repeat[In, Out any](minCount int, p Parser[In, Out]) Parser[In, []Out]
- func Return[In, Out any](value Out) Parser[In, Out]
- func Satisfy[T any](pred func(T) bool) Parser[T, T]
- func Seq2[In, Out, T, T2 any](p Parser[In, T], p2 Parser[In, T2], f func(T, T2) Out) Parser[In, Out]
- func Seq3[In, Out, T, T2, T3 any](p Parser[In, T], p2 Parser[In, T2], p3 Parser[In, T3], f func(T, T2, T3) Out) Parser[In, Out]
- func Seq4[In, Out, T, T2, T3, T4 any](p Parser[In, T], p2 Parser[In, T2], p3 Parser[In, T3], p4 Parser[In, T4], ...) Parser[In, Out]
- func Seq5[In, Out, T, T2, T3, T4, T5 any](p Parser[In, T], p2 Parser[In, T2], p3 Parser[In, T3], p4 Parser[In, T4], ...) Parser[In, Out]
- func Seq6[In, Out, T, T2, T3, T4, T5, T6 any](p Parser[In, T], p2 Parser[In, T2], p3 Parser[In, T3], p4 Parser[In, T4], ...) Parser[In, Out]
- func Seq7[In, Out, T, T2, T3, T4, T5, T6, T7 any](p Parser[In, T], p2 Parser[In, T2], p3 Parser[In, T3], p4 Parser[In, T4], ...) Parser[In, Out]
- func Seq8[In, Out, T, T2, T3, T4, T5, T6, T7, T8 any](p Parser[In, T], p2 Parser[In, T2], p3 Parser[In, T3], p4 Parser[In, T4], ...) Parser[In, Out]
- func Seq9[In, Out, T, T2, T3, T4, T5, T6, T7, T8, T9 any](p Parser[In, T], p2 Parser[In, T2], p3 Parser[In, T3], p4 Parser[In, T4], ...) Parser[In, Out]
- func Try[In, Out any](p Parser[In, Out]) Parser[In, Out]
- type ReaderAt
- type Result
- type SliceReaderAt
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ParseError ¶
type ParseError Message
func (ParseError) Error ¶
func (pe ParseError) Error() string
type Parser ¶
func Bind2 ¶
func Bind2[In, Out, T, T2 any]( p Parser[In, T], f func(T) Parser[In, T2], f2 func(T2) Parser[In, Out], ) Parser[In, Out]
Bind2 is equivalent to 2 nested calls to Bind.
func Bind2Naïve ¶
func Bind3 ¶
func Bind3[In, Out, T, T2, T3 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]
Bind3 is equivalent to 3 nested calls to Bind.
func Bind3Naïve ¶
func Bind4 ¶
func Bind4[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]
Bind4 is equivalent to 4 nested calls to Bind.
func Bind4Naïve ¶
func Bind5 ¶
func Bind5[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]
Bind5 is equivalent to 5 nested calls to Bind.
func Bind5Naïve ¶
func Bind6 ¶
func Bind6[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]
Bind6 is equivalent to 6 nested calls to Bind.
func Bind6Naïve ¶
func Bind7 ¶
func Bind7[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]
Bind7 is equivalent to 7 nested calls to Bind.
func Bind7Naïve ¶
func Bind8 ¶
func Bind8[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]
Bind8 is equivalent to 8 nested calls to Bind.
func Bind8Naïve ¶
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]
func Bind9 ¶
func Bind9[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]
Bind9 is equivalent to 9 nested calls to Bind.
func Bind9Naïve ¶
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]
func Match ¶
func Match[T comparable](x T) Parser[T, T]
Match creates a parser that attempts to read an input value equal to x. If Match succeeds, it returns the matched input value.
func MatchSlice ¶
func MatchSlice[T comparable](s []T) Parser[T, []T]
MatchSlice creates a parser that attempts to read the contents of s from the input. If MatchSlice succeeds, it returns a copy of the matched input values.
func Repeat ¶
Repeat applies p until p fails, and returns the collected outputs. It succeeds if and only if p succeeds at least minCount times. It consumes if and only if at least one of the applications of p consumes.
func Return ¶
Return creates a parser that always succeeds and returns value without consuming any input.
func Satisfy ¶
Satisfy creates a parser that attempts to read an input value for which pred returns true. If Satisfy succeeds, it returns the matched input value.
func Try ¶
Try behaves identically to p, except that if p returns an error, Try will pretend that no input was consumed. This allows infinite lookahead: Since Choose only calls another parser when the previous parser consumed nothing, Try will allow backing out of a complex parser that partially succeeded.
type Result ¶
type Result[In, Out any] struct { // contains filtered or unexported fields }
type SliceReaderAt ¶
type SliceReaderAt[T any] []T
type State ¶
type State[In any] struct { // contains filtered or unexported fields }
func (State[In]) Read ¶
Read fills dst with data from this State's position in the underlying source. It returns the number of data it read and a new State for the position at which the read ended, and an error if the read either (1) failed or (2) reached the end of the source before filling dst. All reads from a given State will return data from the same position the source. If the source had too few data left to fill dst, or if the State's position is at or past the end of the source, err will be io.EOF.