Macro Punct

Source
macro_rules! Punct {
    ["&"] => { ... };
    ["&&"] => { ... };
    ["*"] => { ... };
    ["*="] => { ... };
    ["@"] => { ... };
    ["\\"] => { ... };
    ["`"] => { ... };
    ["!"] => { ... };
    ["!="] => { ... };
    ["^"] => { ... };
    [":"] => { ... };
    ["::"] => { ... };
    ["::"] => { ... };
    [","] => { ... };
    ["-"] => { ... };
    ["--"] => { ... };
    ["-="] => { ... };
    ["$"] => { ... };
    ["."] => { ... };
    ["\""] => { ... };
    ["="] => { ... };
    ["=="] => { ... };
    ["=>"] => { ... };
    ["#"] => { ... };
    ["##"] => { ... };
    ["###"] => { ... };
    ["<"] => { ... };
    ["<="] => { ... };
    ["<<"] => { ... };
    ["<<="] => { ... };
    ["<-"] => { ... };
    ["{"] => { ... };
    ["["] => { ... };
    ["("] => { ... };
    ["\n"] => { ... };
    ["%"] => { ... };
    ["%="] => { ... };
    ["|"] => { ... };
    ["||"] => { ... };
    ["+"] => { ... };
    ["+="] => { ... };
    ["++"] => { ... };
    ["£"] => { ... };
    ["?"] => { ... };
    [">"] => { ... };
    [">="] => { ... };
    [">>"] => { ... };
    [">>="] => { ... };
    ["->"] => { ... };
    ["}"] => { ... };
    ["]"] => { ... };
    [")"] => { ... };
    [";"] => { ... };
    ["'"] => { ... };
    ["/"] => { ... };
    ["/="] => { ... };
    ["//"] => { ... };
    ["//="] => { ... };
    ["  "] => { ... };
    ["    "] => { ... };
    ["\t"] => { ... };
    ["~"] => { ... };
    ["¬"] => { ... };
    ["_"] => { ... };
    [$l:tt, $( $r:tt ),+] => { ... };
    [impl $l:tt] => { ... };
    [impl $l:tt, $( $r:tt ),+] => { ... };
}
Expand description

A macro to get the type of a punctuation token.

To avoid ambiguity, whitespace tokens are not available through this this macro. Instead, use them directly, such as in token::Space4.

If the punctuation you want is not recognised by this macro, split it into its constituent parts, e.g. Punct!["£", "$"] for £$ or Punct!["++", "-"] for ++-.

Note that unlike syn::Token, this macro accepts the token as a quoted string. This allows tokens not recognised by the Rust scanner to be accessed with this macro.