Skip to content

Instantly share code, notes, and snippets.

View AlexCharlton's full-sized avatar

Alex Charlton AlexCharlton

View GitHub Profile
@kyleheadley
kyleheadley / split_comma.rs
Last active April 18, 2021 19:41
Higher-order rust macro that assists in parsing by macro
/// Higher-order macro fold function for pre-parsing comma separated lists
///
/// The commas on KEYWORD lines can be changed to parse lists with any
/// separator.
/// run a macro on a list of lists after splitting the input at commas
macro_rules! split_comma {
// no defaults
{$fun:ident <= $($item:tt)*} => {
split_comma![$fun () () () <= $($item)*]