Macro custom_punctuation
macro_rules! custom_punctuation {
($ident:ident, $($tt:tt)+) => { ... };
}
Define a type that supports parsing and printing a multi-character symbol as if it were a punctuation token.
Usage
custom_punctuation!;
The generated syntax tree node supports the following operations just like any built-in punctuation token.
-
Peeking —
input.peek(LeftRightArrow) -
Parsing —
input.parse::<LeftRightArrow>()? -
Printing —
quote!( ... #lrarrow ... ) -
Construction from a
Span—let lrarrow = LeftRightArrow(sp) -
Construction from multiple
Span—let lrarrow = LeftRightArrow([sp, sp, sp]) -
Field access to its spans —
let spans = lrarrow.spans
Example
use ;
use ;
use Punctuated;
use Expr;
custom_punctuation!;
// expr </> expr </> expr ...