Expand description
Module containing all specific parsers
Structs§
- And
- AndThen
- Any
- Between
- Chainl1
- Chainr1
- Choice
- Expected
- FnParser
- Iter
- Many
- Many1
- Map
- Message
- NotFollowed
By - Optional
- Or
- Satisfy
- SepBy
- Skip
- Skip
Many - Skip
Many1 - Then
- Token
- Try
- Unexpected
- Value
- With
Traits§
- Parser
Ext - Extension trait which provides functions that are more conveniently used through method calls
Functions§
- any
- Parses any token
- between
- Parses
open
followed byparser
followed byclose
Returns the value ofparser
- chainl1
- Parses
p
1 or more times separated byop
The value returned is the one produced by the left associative application ofop
- chainr1
- Parses
p
one or more times separated byop
The value returned is the one produced by the right associative application ofop
- choice
- Takes an array of parsers and tries them each in turn. Fails if all parsers fails or when a parsers fails with a consumed state.
- many
- Parses
p
zero or more times returning a collection with the values fromp
. If the returned collection cannot be inferred type annotations must be supplied, either by annotating the resulting type bindinglet collection: Vec<_> = ...
or by specializing when calling many,many::<Vec<_>, _>(...)
- many1
- Parses
p
one or more times returning a collection with the values fromp
. If the returned collection cannot be inferred type annotations must be supplied, either by annotating the resulting type bindinglet collection: Vec<_> = ...
or by specializing when calling many1many1::<Vec<_>, _>(...)
- not_
followed_ by - Succeeds only if
parser
fails. Never consumes any input. - optional
- Returns
Some(value)
andNone
on parse failure (always succeeds) - parser
- Wraps a function, turning it into a parser Mainly needed to turn closures into parsers as function types can be casted to function pointers to make them usable as a parser
- satisfy
- Parses a token and succeeds depending on the result of
predicate
- sep_by
- Parses
parser
zero or more time separated byseparator
, returning a collection with the values fromp
. If the returned collection cannot be inferred type annotations must be supplied, either by annotating the resulting type bindinglet collection: Vec<_> = ...
or by specializing when calling sep_by,sep_by::<Vec<_>, _, _>(...)
- skip_
many - Parses
p
zero or more times ignoring the result - skip_
many1 - Parses
p
one or more times ignoring the result - token
- Parses a character and succeeds if the characther is equal to
c
- try
- Try acts as
p
except it acts as if the parser hadn’t consumed any input ifp
returns an error after consuming input - unexpected
- Always fails with
message
as the error. Never consumes any input. - value
- Always returns the value
v
without consuming any input.