Crate dynparser[][src]

For an introduction and context view, read...

README.md

A very basic example...

   extern crate dynparser;
   use dynparser::{parse, rules_from_peg};

   fn main() {
       let rules = rules_from_peg(
           r#"

   main            =   letter letter_or_num+

   letter          =   [a-zA-Z]

   letter_or_num   =   letter
                   /   number

   number          =   [0-9]

           "#,
       ).unwrap();

       assert!(parse("a2AA456bzJ88", &rules).is_ok());
   }

Please, read README.md for more context information

Re-exports

pub use peg::rules_from_peg;

Modules

ast

Data information to build the AST And some functions to work with AST

parser

Tools to execute parser of a expression

peg

Module with functions to generate rules from PEG grammar

Macros

and

Concat expressions (and)

dot

Atom::Dot (any character)

ematch

Generate a match expression with optional characters and a list of bounds

lit

Create a literal

not

negate expression

or

Choose expressions (or)

ref_rule

This will create a subexpression refering to a "rule name"

rep

repeat expression. You have to define minimum repetitions and opionally maximum repetitions (if missing, infinite)

rules

Create a map of rules

Functions

parse

Parse a string with a set of rules