tlborm
tlborm copied to clipboard
The Little Book of Rust Macros (updated fork)
> `${count(ident)}`: The number of times `$ident` repeats in the inner-most repetition in total. This is equivalent to `${count(ident, 0)}`. refer to: https://github.com/rust-lang/rust/issues/83527#issuecomment-1070860171
It is not well described in the book as it stands right now
see https://github.com/rust-lang/rust/pull/95860#issuecomment-1097101601
I haven't looked into this too much yet, but if I am not mistaken the `quote` crate uses a neat trick to allow lookahead and lookback-ish matching on tokens, see:...
I believe it would be a nice addition to also cover procedural macros effectively turning the little book into a bigger book. This will most likely require a bit of...
It's really not great atm but I'm currently having trouble going into the topic without touching macro_rules!/proc-macro specifics, https://veykril.github.io/tlborm/syntax-extensions/hygiene.html Basically after https://github.com/Veykril/tlborm/pull/43 lands, the hygiene subchapter of the syntax extension...
Repeating multiple things at once can be tricky, so going more in-depth on that topic would be nice. Also mentiong ways to avoid some problems would be helpful, for example...
The old book had an annotated examples section which basically was meant to show some more complex real world macros with comments explaining it more in-depth. See https://danielkeep.github.io/tlborm/book/aeg-README.html