Module chomp::parsers [] [src]

Basic parsers.

Structs

Error

Common error for the basic Chomp parsers.

Functions

any

Matches any item, returning it if present.

eof

Matches the end of the input.

not_token

Matches a single token as long as it is not equal to t, returning the match on success.

peek

Matches any item but does not consume it, on success it gives Some but if no input remains None is produced.

peek_next

Matches any item but does not consume it.

run_scanner

Like scan but generalized to return the final state of the scanner.

satisfy

Matches an item using f, the item is returned if f yields true, otherwise this parser fails.

satisfy_with

Reads a single token, applies the transformation F and then succeeds with the transformed valeue if the predicate P yields true on this transformed value.

scan

The predicate consumes and transforms a state argument, this parser will match everything until the predicate returns None.

skip_while

Skips over tokens in the input until f returns false.

skip_while1

Skips over tokens in the input until f returns false, skips at least one token and fails if f does not succeed on it.

string

Matches the given slice against the parser, returning the matched slice upon success.

take

Matches num items no matter what they are, returning a slice of the matched items.

take_remainder

Matches the remainder of the buffer and returns it, always succeeds.

take_till

Matches all items until f returns true, all items to that point will be returned as a slice upon success.

take_while

Matches all items while f returns false, returns a slice of all the matched items.

take_while1

Matches all items while f returns true, if at least one item matched this parser succeeds and returns a slice of all the matched items.

token

Matches a single token, returning the match on success.

Type Definitions

SimpleResult

Result returned from the basic parsers.