Macro syn::epsilon
[−]
[src]
macro_rules! epsilon { ($i:expr,) => { ... }; }
Parses nothing and always succeeds.
This can be useful as a fallthrough case in alt!
, as shown below. Also
useful for parsing empty delimiters using parens!
or brackets!
or
braces!
by parsing for example braces!(epsilon!())
for an empty {}
.
- Syntax:
epsilon!()
- Output:
()
#[macro_use] extern crate syn; use syn::synom::Synom; enum Mutability { Mutable(Token![mut]), Immutable, } impl Synom for Mutability { named!(parse -> Self, alt!( keyword!(mut) => { Mutability::Mutable } | epsilon!() => { |_| Mutability::Immutable } )); }
This macro is available if Syn is built with the "parsing"
feature.