Skip to main content

production

Macro production 

Source
macro_rules! production {
    (<$lhs:ident> ::= $($rest:tt)*) => { ... };
    (@collect_exprs [[$($current:expr),*] $($prev_exprs:tt)*] | $($rest:tt)*) => { ... };
    (@collect_exprs [[$($current:expr),*] $($prev_exprs:tt)*] $t:literal $($rest:tt)*) => { ... };
    (@collect_exprs [[$($current:expr),*] $($prev_exprs:tt)*] <$nt:ident> $($rest:tt)*) => { ... };
    (@collect_exprs [[$($last:expr),*] $([$($prev:expr),*])*]) => { ... };
}
Expand description

Macro to create a Production from a right-hand side definition

bnf::production!(<S> ::= 'T' <NT> | <NT> "AND");