Documentation ¶
Index ¶
- func And[S any, B any, M any](x p.Combinator[rune, Position, S], y p.Combinator[rune, Position, B], ...) p.Combinator[rune, Position, M]
- func Angles[T any](body p.Combinator[rune, Position, T]) p.Combinator[rune, Position, T]
- func Any() p.Combinator[rune, Position, rune]
- func Between[T any, S any, B any](pre p.Combinator[rune, Position, T], c p.Combinator[rune, Position, S], ...) p.Combinator[rune, Position, S]
- func Braces[T any](body p.Combinator[rune, Position, T]) p.Combinator[rune, Position, T]
- func Buffer(data []rune, newLineRunes ...rune) *buffer
- func Cast[T any, S any](c p.Combinator[rune, Position, T], f func(T) (S, error)) p.Combinator[rune, Position, S]
- func Chainl[T any](c p.Combinator[rune, Position, T], ...) p.Combinator[rune, Position, T]
- func Chainl1[T any](c p.Combinator[rune, Position, T], ...) p.Combinator[rune, Position, T]
- func Chainr[T any](c p.Combinator[rune, Position, T], ...) p.Combinator[rune, Position, T]
- func Chainr1[T any](c p.Combinator[rune, Position, T], ...) p.Combinator[rune, Position, T]
- func Choice[T any](cs ...p.Combinator[rune, Position, T]) p.Combinator[rune, Position, T]
- func Colon() p.Combinator[rune, Position, rune]
- func Comma() p.Combinator[rune, Position, rune]
- func Concat[T any](cap int, cs ...p.Combinator[rune, Position, []T]) p.Combinator[rune, Position, []T]
- func Const[S any](value S) p.Combinator[rune, Position, S]
- func Count[T any](n int, c p.Combinator[rune, Position, T]) p.Combinator[rune, Position, []T]
- func Dot() p.Combinator[rune, Position, rune]
- func EOF() p.Combinator[rune, Position, bool]
- func EndBy[T any, S any](cap int, body p.Combinator[rune, Position, T], ...) p.Combinator[rune, Position, []T]
- func EndBy1[T any, S any](cap int, body p.Combinator[rune, Position, T], ...) p.Combinator[rune, Position, []T]
- func Eq(t rune) p.Combinator[rune, Position, rune]
- func Fail[S any](err error) p.Combinator[rune, Position, S]
- func Gt(t rune) p.Combinator[rune, Position, rune]
- func Gte(t rune) p.Combinator[rune, Position, rune]
- func IsControl() p.Combinator[rune, Position, rune]
- func IsDigit() p.Combinator[rune, Position, rune]
- func IsGraphic() p.Combinator[rune, Position, rune]
- func IsLetter() p.Combinator[rune, Position, rune]
- func IsLower() p.Combinator[rune, Position, rune]
- func IsMark() p.Combinator[rune, Position, rune]
- func IsNumber() p.Combinator[rune, Position, rune]
- func IsPrint() p.Combinator[rune, Position, rune]
- func IsPunct() p.Combinator[rune, Position, rune]
- func IsSpace() p.Combinator[rune, Position, rune]
- func IsSymbol() p.Combinator[rune, Position, rune]
- func IsTitle() p.Combinator[rune, Position, rune]
- func IsUpper() p.Combinator[rune, Position, rune]
- func Lt(t rune) p.Combinator[rune, Position, rune]
- func Lte(t rune) p.Combinator[rune, Position, rune]
- func Many[T any](cap int, c p.Combinator[rune, Position, T]) p.Combinator[rune, Position, []T]
- func ManyTill[T any, S any](cap int, c p.Combinator[rune, Position, T], ...) p.Combinator[rune, Position, []T]
- func Map[K comparable, V any](cases map[K]V, c p.Combinator[rune, Position, K]) p.Combinator[rune, Position, V]
- func MapStrings[V any](cases map[string]V) p.Combinator[rune, Position, V]
- func NoneOf(data ...rune) p.Combinator[rune, Position, rune]
- func NotEq(t rune) p.Combinator[rune, Position, rune]
- func NotRange(from rune, to rune) p.Combinator[rune, Position, rune]
- func OneOf(data ...rune) p.Combinator[rune, Position, rune]
- func OneOfStrings(strs ...string) p.Combinator[rune, Position, string]
- func Optional[T any](c p.Combinator[rune, Position, T], def T) p.Combinator[rune, Position, T]
- func Or[T any](x p.Combinator[rune, Position, T], y p.Combinator[rune, Position, T]) p.Combinator[rune, Position, T]
- func Padded[T any, S any](skip p.Combinator[rune, Position, S], body p.Combinator[rune, Position, T]) p.Combinator[rune, Position, T]
- func Parens[T any](body p.Combinator[rune, Position, T]) p.Combinator[rune, Position, T]
- func Parse[T any](data []rune, parse p.Combinator[rune, Position, T]) (T, error)
- func ParseString[T any](str string, parse p.Combinator[rune, Position, T]) (T, error)
- func Range(from rune, to rune) p.Combinator[rune, Position, rune]
- func Satisfy(greedy bool, f p.Condition[rune]) p.Combinator[rune, Position, rune]
- func Semi() p.Combinator[rune, Position, rune]
- func SepBy[T any, S any](cap int, body p.Combinator[rune, Position, T], ...) p.Combinator[rune, Position, []T]
- func SepBy1[T any, S any](cap int, body p.Combinator[rune, Position, T], ...) p.Combinator[rune, Position, []T]
- func SepEndBy[T any, S any](cap int, body p.Combinator[rune, Position, T], ...) p.Combinator[rune, Position, []T]
- func SepEndBy1[T any, S any](cap int, body p.Combinator[rune, Position, T], ...) p.Combinator[rune, Position, []T]
- func Sequence[T any](cap int, cs ...p.Combinator[rune, Position, T]) p.Combinator[rune, Position, []T]
- func SequenceOf(data ...rune) p.Combinator[rune, Position, []rune]
- func Skip[T any, S any](skip p.Combinator[rune, Position, S], body p.Combinator[rune, Position, T]) p.Combinator[rune, Position, T]
- func SkipAfter[T any, S any](skip p.Combinator[rune, Position, S], body p.Combinator[rune, Position, T]) p.Combinator[rune, Position, T]
- func SkipMany[T any, S any](skip p.Combinator[rune, Position, S], body p.Combinator[rune, Position, T]) p.Combinator[rune, Position, T]
- func Some[T any](cap int, c p.Combinator[rune, Position, T]) p.Combinator[rune, Position, []T]
- func Squares[T any](body p.Combinator[rune, Position, T]) p.Combinator[rune, Position, T]
- func String(str string) p.Combinator[rune, Position, string]
- func TimeZone(locations ...*time.Location) p.Combinator[rune, Position, *time.Location]
- func TimeZoneByNames(locationNames ...string) (p.Combinator[rune, Position, *time.Location], error)
- func Trace[T any](l p.Logged, m string, c p.Combinator[rune, Position, T]) p.Combinator[rune, Position, T]
- func Try[T any](c p.Combinator[rune, Position, T]) p.Combinator[rune, Position, T]
- func Unsigned[T constraints.Integer]() p.Combinator[rune, Position, T]
- func UnsignedN[T constraints.Integer](n int) p.Combinator[rune, Position, T]
- type Position
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func And ¶
func And[S any, B any, M any]( x p.Combinator[rune, Position, S], y p.Combinator[rune, Position, B], compose p.Composer[S, B, M], ) p.Combinator[rune, Position, M]
And - use x and y combinators to consume input data. Apply them result to compose function and return result of it.
func Angles ¶
func Angles[T any]( body p.Combinator[rune, Position, T], ) p.Combinator[rune, Position, T]
Angles - parse something between angels characters - '<' and '>'.
func Between ¶
func Between[T any, S any, B any]( pre p.Combinator[rune, Position, T], c p.Combinator[rune, Position, S], suf p.Combinator[rune, Position, B], ) p.Combinator[rune, Position, S]
Between - parse sequence of input combinators, skip first and last results.
func Braces ¶
func Braces[T any]( body p.Combinator[rune, Position, T], ) p.Combinator[rune, Position, T]
Braces - parse something between braces characters - '{' and '}'.
func Cast ¶
func Cast[T any, S any]( c p.Combinator[rune, Position, T], f func(T) (S, error), ) p.Combinator[rune, Position, S]
Cast - parse data by c combinator and apply to f function. Return result of f function.
func Chainl ¶
func Chainl[T any]( c p.Combinator[rune, Position, T], op p.Combinator[rune, Position, func(T, T) T], def T, ) p.Combinator[rune, Position, T]
Chainl - read zero or more occurrences of data readed by c combinator, separated by op combinator. Returns a value obtained by a left associative application of all functions returned by op combinator to the values returned by c combinator. If nothing read, the value def is returned.
func Chainl1 ¶
func Chainl1[T any]( c p.Combinator[rune, Position, T], op p.Combinator[rune, Position, func(T, T) T], ) p.Combinator[rune, Position, T]
Chainl1 - read one or more occurrences of data readed by c combinator, separated by data readed by op combinator. Returns a value obtained by a left associative application of all functions returned by op combinator to the values returned by c combinator. If nothing read, the value def is returned.
func Chainr ¶
func Chainr[T any]( c p.Combinator[rune, Position, T], op p.Combinator[rune, Position, func(T, T) T], def T, ) p.Combinator[rune, Position, T]
Chainr - read zero or more occurrences of data readed by c combinator, separated by op combinator. Returns a value obtained by a right associative application of all functions returned by op to the values returned by c combinator. If nothing read, the value def is returned.
func Chainr1 ¶
func Chainr1[T any]( c p.Combinator[rune, Position, T], op p.Combinator[rune, Position, func(T, T) T], ) p.Combinator[rune, Position, T]
Chainr - read one or more occurrences of data readed by c combinator, separated by op combinator. Returns a value obtained by a right associative application of all functions returned by op to the values returned by c combinator. If nothing read, the value def is returned.
func Choice ¶
func Choice[T any]( cs ...p.Combinator[rune, Position, T], ) p.Combinator[rune, Position, T]
Choice - searches for a combinator that works successfully on the input data. if one is not found, it returns an NothingMatched error.
func Concat ¶
func Concat[T any]( cap int, cs ...p.Combinator[rune, Position, []T], ) p.Combinator[rune, Position, []T]
Concat - use cs combinators to parse slices step by step, concatenate all result to one big slice and returns it.
func Const ¶
func Const[S any](value S) p.Combinator[rune, Position, S]
Const - doesn't read anything, just return the input value.
func Count ¶
func Count[T any]( n int, c p.Combinator[rune, Position, T], ) p.Combinator[rune, Position, []T]
Count - try to read X item by c combinator. Stop on first error.
func EOF ¶
func EOF() p.Combinator[rune, Position, bool]
EOF - checks that buffer reading has finished.
func EndBy ¶
func EndBy[T any, S any]( cap int, body p.Combinator[rune, Position, T], sep p.Combinator[rune, Position, S], ) p.Combinator[rune, Position, []T]
EndBy - read zero or more occurrences of data readed by c combinator, separated and ended by data readed by sep combinator. Returns a slice of values returned by p.
func EndBy1 ¶
func EndBy1[T any, S any]( cap int, body p.Combinator[rune, Position, T], sep p.Combinator[rune, Position, S], ) p.Combinator[rune, Position, []T]
EndBy1 - read one or more occurrences of data readed by c combinator, separated and ended by data readed by sep combinator. Returns a slice of values returned by c combinator.
func Eq ¶
Eq - succeeds for any item which equal input t. Returns the item that is actually readed from input buffer. Greedy by default - keep position after reading.
func Gt ¶
Gt - succeeds for any item which greater than input value. Returns the item that is actually readed from input buffer. Greedy by default - keep position after reading.
func Gte ¶
Gte - succeeds for any item which greater than or equal input value. Returns the item that is actually readed from input buffer. Greedy by default - keep position after reading.
func IsControl ¶
func IsControl() p.Combinator[rune, Position, rune]
IsControl - parse control UTF-8 characters.
func IsDigit ¶
func IsDigit() p.Combinator[rune, Position, rune]
IsDigit - parse decimal digit UTF-8 characters.
func IsGraphic ¶
func IsGraphic() p.Combinator[rune, Position, rune]
IsGraphic - parse graphic UTF-8 characters.
func IsLetter ¶
func IsLetter() p.Combinator[rune, Position, rune]
IsLetter - parse letter UTF-8 characters.
func IsLower ¶
func IsLower() p.Combinator[rune, Position, rune]
IsLower - parse UTF-8 character in lower case.
func IsMark ¶
func IsMark() p.Combinator[rune, Position, rune]
IsLower - parse mark UTF-8 characters.
func IsNumber ¶
func IsNumber() p.Combinator[rune, Position, rune]
IsNumber - parse UTF-8 number characters.
func IsPrint ¶
func IsPrint() p.Combinator[rune, Position, rune]
IsPrint - parse printable UTF-8 characters.
func IsPunct ¶
func IsPunct() p.Combinator[rune, Position, rune]
IsPunct - parse UTF-8 punctuation character.
func IsSpace ¶
func IsSpace() p.Combinator[rune, Position, rune]
IsSpace - parse UTF-8 space character.
func IsSymbol ¶
func IsSymbol() p.Combinator[rune, Position, rune]
IsSpace - parse UTF-8 symbolic character.
func IsTitle ¶
func IsTitle() p.Combinator[rune, Position, rune]
IsTitle - parse UTF-8 character in title case.
func IsUpper ¶
func IsUpper() p.Combinator[rune, Position, rune]
IsLower - parse UTF-8 character in upper case.
func Lt ¶
Lt - succeeds for any item which less than input value. Returns the item that is actually readed from input buffer. Greedy by default - keep position after reading.
func Lte ¶
Lte - succeeds for any item which less than or equal input value. Returns the item that is actually readed from input buffer. Greedy by default - keep position after reading.
func Many ¶
func Many[T any]( cap int, c p.Combinator[rune, Position, T], ) p.Combinator[rune, Position, []T]
Many - accumulate data which returned by c consumer until it possible. Stop on first error or end of buffer. Returns an empty slice even if nothing could be parsed.
func ManyTill ¶
func ManyTill[T any, S any]( cap int, c p.Combinator[rune, Position, T], end p.Combinator[rune, Position, S], ) p.Combinator[rune, Position, []T]
ManyTill - accumulate data readed by c combinator until combinantor end succeeds. Returns a slice of values returned by body combinator.
func Map ¶
func Map[K comparable, V any]( cases map[K]V, c p.Combinator[rune, Position, K], ) p.Combinator[rune, Position, V]
Map - Reads one element from the input buffer using the combinator, then uses the resulting element to obtain a value from the map cases and try to match it in cases map passed by first argument. If the value is not found then it returns NothingMatched error.
func MapStrings ¶
MapStrings - Reads text from the input buffer using the combinator and match it in on the fly by cases map passed by first argument. If the value is not found then it returns NothingMatched error. This combinator use special trie-like structure for text matching.
func NoneOf ¶
NoneOf - succeeds for any item which not included in input data. Returns the item that is actually readed from input buffer. Greedy by default - keep position after reading.
func NotEq ¶
NotEq - succeeds for any item which not equal input t. Returns the item that is actually readed from input buffer. Greedy by default - keep position after reading.
func NotRange ¶
NotRange - succeeds for any item which not included in input range. Returns the item that is actually readed from input buffer. Greedy by default - keep position after reading.
func OneOf ¶
OneOf - succeeds for any item which included in input data. Returns the item that is actually readed from input buffer. Greedy by default - keep position after reading.
func OneOfStrings ¶
OneOfStrings - succeeds for any item which included in input data. Returns the item that is actually readed from input buffer. Greedy by default - keep position after reading.
func Optional ¶
func Optional[T any]( c p.Combinator[rune, Position, T], def T, ) p.Combinator[rune, Position, T]
Optional - use c combinator to consume input data from buffer. If it failed, than return def value.
func Or ¶
func Or[T any]( x p.Combinator[rune, Position, T], y p.Combinator[rune, Position, T], ) p.Combinator[rune, Position, T]
Or - returns the result of the first combinator, if it fails, uses the second combinator.
func Padded ¶
func Padded[T any, S any]( skip p.Combinator[rune, Position, S], body p.Combinator[rune, Position, T], ) p.Combinator[rune, Position, T]
Padded - skip sequence of items parsed by first combinator before and after body combinator.
func Parens ¶
func Parens[T any]( body p.Combinator[rune, Position, T], ) p.Combinator[rune, Position, T]
Parens - parse something between parens characters - '(' and ')'.
func ParseString ¶
ParseString - parse text by c combinator.
func Range ¶
Range - succeeds for any item which include in input range. Returns the item that is actually readed from input buffer. Greedy by default - keep position after reading.
func Satisfy ¶
Satisfy - succeeds for any item for which the supplied function f returns true. Returns the item that is actually readed from input buffer. if greedy buffer keep position after reading.
func SepBy ¶
func SepBy[T any, S any]( cap int, body p.Combinator[rune, Position, T], sep p.Combinator[rune, Position, S], ) p.Combinator[rune, Position, []T]
SepBy - read zero or more occurrences of data readed by c combinator, separated by sep combinator. Returns a slice of values returned by p.
func SepBy1 ¶
func SepBy1[T any, S any]( cap int, body p.Combinator[rune, Position, T], sep p.Combinator[rune, Position, S], ) p.Combinator[rune, Position, []T]
SepBy1 - read one or more occurrences of data readed by c combinator, separated by sep combinator. Returns a slice of values returned by p.
func SepEndBy ¶
func SepEndBy[T any, S any]( cap int, body p.Combinator[rune, Position, T], sep p.Combinator[rune, Position, S], ) p.Combinator[rune, Position, []T]
SepEndBy - read zero or more occurrences of data readed by body combinator, separated and optionally ended by data readed by sep combinator. Returns a slice of values returned by body combinator.
func SepEndBy1 ¶
func SepEndBy1[T any, S any]( cap int, body p.Combinator[rune, Position, T], sep p.Combinator[rune, Position, S], ) p.Combinator[rune, Position, []T]
SepEndBy1 - read one or more occurrences of data readed by body combinator, separated and optionally ended by data readed by sep combinator. Returns a slice of values returned by body combinator.
func Sequence ¶
func Sequence[T any]( cap int, cs ...p.Combinator[rune, Position, T], ) p.Combinator[rune, Position, []T]
Sequence - reads input elements one by one using cs combinators. If any of them fails, it returns an error.
func SequenceOf ¶
SequenceOf - expects a sequence of elements in the buffer equal to the input data sequence. If expectations are not met, returns NothingMatched error.
func Skip ¶
func Skip[T any, S any]( skip p.Combinator[rune, Position, S], body p.Combinator[rune, Position, T], ) p.Combinator[rune, Position, T]
Skip - ignores the result of the first combinator and returns only the result of the second.
func SkipAfter ¶
func SkipAfter[T any, S any]( skip p.Combinator[rune, Position, S], body p.Combinator[rune, Position, T], ) p.Combinator[rune, Position, T]
SkipAfter - ignores the result of the first combinator and returns only the result of the second. Use body combinator at first.
func SkipMany ¶
func SkipMany[T any, S any]( skip p.Combinator[rune, Position, S], body p.Combinator[rune, Position, T], ) p.Combinator[rune, Position, T]
SkipMany - skip sequence of items parsed by first combinator before body combinator.
func Some ¶
func Some[T any]( cap int, c p.Combinator[rune, Position, T], ) p.Combinator[rune, Position, []T]
Some - accumulate data which returned by c consumer until it possible. Stop on first error or end of buffer. Returns an error if at least one element could not be read.
func Squares ¶
func Squares[T any]( body p.Combinator[rune, Position, T], ) p.Combinator[rune, Position, T]
Squares - parse something between squares characters - '[' and ']'.
func String ¶
String - read input text and match with string passed by first argument. If the text not matched then it returns NothingMatched error.
func TimeZoneByNames ¶
func TimeZoneByNames( locationNames ...string, ) (p.Combinator[rune, Position, *time.Location], error)
TimeZoneByNames - parse one of time zones from passed arguments.
func Trace ¶
func Trace[T any]( l p.Logged, m string, c p.Combinator[rune, Position, T], ) p.Combinator[rune, Position, T]
Trace - writes messages to the log about the state of the buffer before and after using the combinator, the result of the cobinator and its error.
func Try ¶
func Try[T any](c p.Combinator[rune, Position, T]) p.Combinator[rune, Position, T]
Try - try to use c combinator, if it falls, it returns buffer to the previous position.
func Unsigned ¶
func Unsigned[T constraints.Integer]() p.Combinator[rune, Position, T]
Unsigned - parse unsigned integer.
func UnsignedN ¶
func UnsignedN[T constraints.Integer](n int) p.Combinator[rune, Position, T]
UnsignedN - parse unsigned integer with N count of digits.