macro_rules! rule {
( ( $($inner:tt)* ) ) => { ... };
( { $($inner:tt)* } ) => { ... };
( [ $inner:tt ] ) => { ... };
( @AS_EXPR $x:tt $($tail:tt)* ) => { ... };
( $x:literal $($tail:tt)* ) => { ... };
( $x:ident $($tail:tt)* ) => { ... };
( $a:tt -> $b:tt $($tail:tt)* ) => { ... };
( $a:tt => $b:tt $($tail:tt)* ) => { ... };
( $a:tt . $method:ident ( $($args:tt)* ) $($tail:tt)* ) => { ... };
( $a:tt -& $b:tt $($tail:tt)* ) => { ... };
( $a:tt &- $b:tt $($tail:tt)* ) => { ... };
( $a:tt & $b:tt $($tail:tt)* ) => { ... };
( $a:tt *= $b:tt $($tail:tt)* ) => { ... };
( $a:tt * $($tail:tt)* ) => { ... };
( $a:tt + $($tail:tt)* ) => { ... };
( $a:tt ? $($tail:tt)* ) => { ... };
( $a:tt | $($b:tt)* ) => { ... };
( | $($a:tt)* ) => { ... };
( & $($a:tt)* ) => { ... };
( $x:tt ) => { ... };
( $($tail:tt)* ) => { ... };
}
A macro to define parser rules.
Note that |
has a lower precedence than all other operators
Syntax | Name | Description |
x & y | then | Equivalent to x.then(y) |
x | y | or | Equivalent to x.or(y) |
x * | any | Equivalent to x.repeat(..) |
x + | at least one | Equivalent to x.repeat(1..) |
x ? | optional | Equivalent to x.or_not() |
x -& y | delimiter for | Equivalent to x.delimiter_for(y) |
x &- y | delimited by | Equivalent to x.delimited_by(y) |
x *= N | repeat | Equivalent to x.repeat(N) |
x -> Y | to | Equivalent to x.to(y) |
x => F | map | Equivalent to x.map(F) |
[ X ] | all of | Equivalent to all_of(X) |
{ X } | expr | Considers X to be a Rust expression |