parser

package module
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Alphanumeric = Or(Alpha, Digit)
View Source
var Digit = RuneRange('0', '9')
View Source
var HexLetters = Or(RuneRange('a', 'f'), RuneRange('A', 'F'))
View Source
var Hexadecimal = Or(Digit, HexLetters)
View Source
var Lowercase = RuneRange('a', 'z')
View Source
var Uppercase = RuneRange('A', 'Z')
View Source
var Whitespace = AnyOfRune(' ', '\t', '\r', '\n', '\v', '\f')

Functions

func AnyRune

func AnyRune(in string) (rune, string, error)

Types

type Mapper

type Mapper[T, U any] func(in U) T

type Parser

type Parser[T, U any] func(in U) (T, U, error)

func AllRunes

func AllRunes(valid ...rune) Parser[[]rune, string]

func AnyOfRune added in v0.1.3

func AnyOfRune(valid ...rune) Parser[rune, string]

func DropResult added in v0.1.4

func DropResult[T, U any](parser Parser[T, U]) Parser[T, U]

func ExpectRune

func ExpectRune(expect rune) Parser[rune, string]

func Not

func Not[T any](parser Parser[T, T]) Parser[T, T]

func Or

func Or[T, U any](parsers ...Parser[T, U]) Parser[T, U]

func ParseUntilPredicateSatisfied added in v0.1.3

func ParseUntilPredicateSatisfied[T, U any](parser Parser[T, U],
	predicate func(in U) bool) Parser[[]T, U]

func ParserMap

func ParserMap[T, U, V any](parser Parser[T, U], mapper Mapper[V, T]) Parser[V, U]

func RuneRange

func RuneRange(lower, upper rune) Parser[rune, string]

func Sequence

func Sequence[T, U any](parsers ...Parser[T, U]) Parser[[]T, U]

func TagAsRuneSlice

func TagAsRuneSlice(tag string) Parser[[]rune, string]

func TagAsString

func TagAsString(tag string) Parser[string, string]

func TakeAtLeast

func TakeAtLeast[T, U any](
	num int,
	parser Parser[T, U]) Parser[[]T, U]

func TakeBetween

func TakeBetween[T, U any](
	min, max int,
	parser Parser[T, U]) Parser[[]T, U]

func TakeExactly

func TakeExactly[T, U any](
	num int,
	parser Parser[T, U]) Parser[[]T, U]

func TakeOneOrMore

func TakeOneOrMore[T, U any](parser Parser[T, U]) Parser[[]T, U]

func TakeRuneUntil added in v0.1.3

func TakeRuneUntil(r rune) Parser[[]rune, string]

func TakeZeroOrMore

func TakeZeroOrMore[T, U any](parser Parser[T, U]) Parser[[]T, U]

Jump to

Keyboard shortcuts

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