sequence

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Accumulate

func Accumulate[R parser.Reader, A, T any](
	acc A, f parser.Accumulator[T, A], parsers ...parser.Parser[R, T],
) parser.Parser[R, A]

Accumulate Matches a sequence of parsers and accumulates the results.

func AccumulateBytes

func AccumulateBytes[R parser.Reader](parsers ...parser.Parser[R, []byte]) parser.Parser[R, []byte]

AccumulateBytes Matches a sequence of byte slice parsers and accumulates the results.

func Delimited

func Delimited[R parser.Reader, F, S, T any](
	first parser.Parser[R, F], second parser.Parser[R, S], third parser.Parser[R, T],
) parser.Parser[R, S]

Delimited Matches an object from the first parser and discards it, then gets an object from the second parser, and finally matches an object from the third parser and discards it.

func Pair

func Pair[R parser.Reader, F, S any](first parser.Parser[R, F], second parser.Parser[R, S]) parser.Parser[R, parser.Pair[F, S]]

Pair Gets an object from the first parser, then gets another object from the second parser.

func Preceded

func Preceded[R parser.Reader, F, S any](first parser.Parser[R, F], second parser.Parser[R, S]) parser.Parser[R, S]

Preceded Matches an object from the first parser and discards it, then gets an object from the second parser.

func SeparatedPair

func SeparatedPair[R parser.Reader, F, S, T any](
	first parser.Parser[R, F], separator parser.Parser[R, T], second parser.Parser[R, S],
) parser.Parser[R, parser.Pair[F, S]]

func Terminated

func Terminated[R parser.Reader, F, S any](first parser.Parser[R, F], second parser.Parser[R, S]) parser.Parser[R, F]

Terminated Gets an object from the first parser, then matches an object from the second parser and discards it.

func Tuple

func Tuple[R parser.Reader, T any](parsers ...parser.Parser[R, T]) parser.Parser[R, []T]

Tuple applies a number of parsers one by one and returns their results as a slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL