Expand description

Selected nom parser combinators (complete version, no streaming)

Re-exports

pub use nom;
pub use crate::call;
pub use crate::do_parse;

Modules

non-streaming version parser combinators

streaming version parser combinators

Macros

macro imported from nom 6

macro imported from nom 6

Traits

Helper trait to convert a parser’s result to a more manageable type

Show nice parse trace on Error.

Functions

Recognizes zero or more lowercase and uppercase ASCII alphabetic characters: a-z, A-Z

Recognizes one or more lowercase and uppercase ASCII alphabetic characters: a-z, A-Z

Recognizes zero or more ASCII numerical and alphabetic characters: 0-9, a-z, A-Z

Recognizes one or more ASCII numerical and alphabetic characters: 0-9, a-z, A-Z

Tests a list of parsers one by one until one succeeds.

Create a new error from an input position, a static string and an existing error. This is used mainly in the context combinator, to add user friendly information to errors when backtracking through a parse tree

Runs the embedded parser a specified number of times. Returns the results in a Vec.

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.

Recognizes zero or more ASCII numerical characters: 0-9

Recognizes one or more ASCII numerical characters: 0-9

Recognizes floating point number in text format and returns a f64.

Match line ending preceded with zero or more whitespace chracters

Returns the longest slice of the matches the pattern.

Parse till certain characters are met.

Take and consuming to token.

Repeats the embedded parser until it fails and returns the results in a Vec.

Runs the embedded parser until it fails and returns the results in a Vec. Fails if the embedded parser does not produce at least one result.

Repeats the embedded parser n times or until it fails and returns the results in a Vec. Fails if the embedded parser does not succeed at least m times.

Applies the parser f until the parser g produces a result. Returns a pair consisting of the results of f in a Vec and the result of g.

Maps a function on the result of a parser.

Applies a function returning an Option over the result of a parser.

Applies a function returning a Result over the result of a parser.

Recognizes zero or more spaces, tabs, carriage returns and line feeds.

Recognizes one or more spaces, tabs, carriage returns and line feeds.

Succeeds if the child parser returns an error.

Anything except whitespace, this parser will not consume “\n” character

Recognizes one of the provided characters.

Optional parser: Will return None if not successful.

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

Tries to apply its parser without consuming the input.

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

Parse a line containing a float number

Parse a line containing many float numbers

Read a new line including eol (\n) or consume the rest if there is no eol char.

Read the remaining line. Return a line excluding eol.

Parse a line containing an unsigned integer number.

Parse a line containing many unsigned integers

Alternates between two parsers to produce a list of elements.

Alternates between two parsers to produce a list of elements. Fails if the element parser does not produce at least one element.

Gets an object from the first parser, then matches an object from the sep_parser and discards it, then gets another object from the second parser.

Match one unsigned integer: -123 or +123

Recognizes zero or more spaces and tabs.

Recognizes one or more spaces and tabs.

Recognizes a pattern

Recognizes a case insensitive pattern.

Returns an input slice containing the first N input elements (Input[..N]).

Return and consume n elements from input string slice.

Returns the input slice up to the first occurrence of the pattern.

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

Applies a tuple of parsers one by one and returns their results as a tuple.

Match one unsigned integer: 123

A combinator that takes a parser inner and produces a parser that also consumes both leading and trailing whitespace, returning the output of inner.

Consume three float numbers separated by one or more spaces. Return xyz array.

Type Definitions

parse result with verbose error