Crate yarpl[][src]

yarpl is Yet Another Parsing Library which uses declarative macros.

Each macro uses a modified function declaration syntax and will expand to a function with the type fn (String, usize) -> ParseResult.

Usage

yarpl macros will take an identifier, then a block containing that parser's one or more children.

For example, parsing a simple terminal symbol can be done by calling the just! macro like so:

just!( pub plus { "+"; } ); 

Then, just call the function with some source String and an index.

let result = plus( "+".to_owned(), 0 );

assert!( result.is_ok() );

Modules

and
just
maybe
not
or
repeat
same_as

Macros

and

Calls a sequence of parsers, failing completely if one returns Err.

just

Tries to match the provided string to the current place in the input.

maybe

Will return an Ok(Progress) whether or not its held parsing function is successful.

not

Will return the opposite result of some other parser.

or

Holds the result of the most successful symbol it parses, if there is one.

repeat

Using a modified, regular-expression-like syntax, repeatedly calls another parser the number of times specified.

same_as

An anonymous version of or! - renames its function's ParseResult the name of its child Parser.

Structs

ParseError

Debugging information traced from failed parse.

Progress

Used to track progress of an on-going parse.

Enums

Done

Concrete syntax tree formed from a parsing function.

Type Definitions

ParseResult

Return type of yarpl macros.

Parser

An alias for the function signature of yarpl macros.