[][src]Module gchemol_parser::parsers

Re-exports

pub use nom;

Modules

complete
streaming

Macros

do_parse

do_parse!(I->IResult<I,A> >> I->IResult<I,B> >> ... I->IResult<I,X> , ( O ) ) => I -> IResult<I, O> do_parse applies sub parsers in a sequence. it can store intermediary results and make them available for later parsers

Functions

alpha0

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

alpha1

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

alphanumeric0

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

alphanumeric1

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

alt

tests a list of parsers one by one until one succeeds

count

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

delimited

Matches an object from the first parser, then gets an object from the sep_parser, then matches another object from the second parser.

digit0

Recognizes zero or more ASCII numerical characters: 0-9

digit1

Recognizes one or more ASCII numerical characters: 0-9

double

Recognizes floating point number in a byte string and returns a f64

eol

Match line ending preceded with zero or more whitespace chracters

is_a

Returns the longest slice of the matches the pattern

is_not

Parse till certain characters are met

jump_to

Take and consuming to token.

many0

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

many1

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.

many_m_n

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.

many_till

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.

map

maps a function on the result of a parser

map_opt

applies a function returning an Option over the result of a parser

map_res

applies a function returning a Result over the result of a parser

multispace0

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

multispace1

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

not

succeeds if the child parser returns an error

not_space

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

one_of

Recognizes one of the provided characters.

opt

optional parser: will return None if not successful

pair

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

peek

tries to apply its parser without consuming the input

preceded

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

read_line

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

read_until_eol

Read the remaining line. Return a line excluding eol.

read_usize

Parse a line containing an unsigned integer number.

separated_list

Alternates between two parsers to produce a list of elements.

separated_nonempty_list

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

separated_pair

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.

signed_digit
space0

Recognizes zero or more spaces and tabs.

space1

Recognizes one or more spaces and tabs.

tag

Recognizes a pattern

tag_no_case

Recognizes a case insensitive pattern

take

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

take_s

Return and consume n elements from input string slice.

take_until

Returns the longest input slice till it matches the pattern.

terminated

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

tuple

applies a tuple of parsers one by one and returns their results as a tuple

unsigned_digit

Match one unsigned integer: 123

xyz_array

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

Type Definitions

IResult

Holds the result of parsing functions