From ae285a4caa9215550af0b6e614fa99a1acdf652c Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 16 May 2019 01:16:30 +0100 Subject: [PATCH] wip macros slide --- macro-rules-example.txt | 6 +++++- macros.fig | 23 +++++++++++------------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/macro-rules-example.txt b/macro-rules-example.txt index af3dc55..25c1fe0 100644 --- a/macro-rules-example.txt +++ b/macro-rules-example.txt @@ -1,3 +1,7 @@ macro_rules! debug { - ($g:expr, $($rhs:tt)*) => { (if debugp!($g) { eprint!($($rhs)*); }) } + ($g:expr, $($rhs:tt)*) => { + ( + if debugp!($g) { eprint!($($rhs)*); } + ) + } } diff --git a/macros.fig b/macros.fig index 65d3daf..8958c0c 100644 --- a/macros.fig +++ b/macros.fig @@ -7,18 +7,17 @@ A4 Single -2 1200 2 +1 2 0 2 1 7 50 -1 -1 0.000 1 0.0000 3015 -1395 2565 315 450 -1710 5580 -1080 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 - -1350 1125 10800 1125 -2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 - -1350 5940 10800 5940 + -1350 2970 10800 2970 2 5 0 1 0 -1 60 -1 -1 0.000 0 0 -1 0 0 5 0 serde-example.txt.eps - -1170 -2250 10800 -2250 10800 2430 -1170 2430 -1170 -2250 -4 0 0 50 -1 2 30 0.0000 4 375 2565 -900 2025 Ian Jackson\001 -4 0 0 50 -1 2 30 0.0000 4 330 1275 4050 2025 Citrix\001 -4 0 0 50 -1 2 30 0.0000 4 435 2115 5850 2025 May 2019\001 -4 0 0 50 -1 2 30 0.0000 4 435 5655 0 3870 curmudgeon and pessimist\001 -4 0 0 50 -1 2 30 0.0000 4 435 5400 0 4590 Perl, C, Tcl, Python, bash\001 -4 0 0 50 -1 2 30 0.0000 4 330 2505 -450 3240 Who am I ?\001 -4 0 0 50 -1 2 30 0.0000 4 435 10320 0 5310 some C++, Haskell, Ocaml, asm, JS, Lisp, Java...\001 -4 0 0 60 -1 0 20 0.0000 4 300 8715 -990 6570 Some examples taken from the Rust Book etc, Apache 2.0 / MIT\001 + -1170 -2250 11340 -2250 11340 2512 -1170 2512 -1170 -2250 +2 5 0 1 0 -1 60 -1 -1 0.000 0 0 -1 0 0 5 + 0 macro-rules-example.txt.eps + -1170 3330 9054 3330 9054 5712 -1170 5712 -1170 3330 +4 0 1 50 -1 0 30 0.0000 4 330 2175 8280 1530 Awesome!\001 +4 0 4 50 -1 0 30 0.0000 4 435 7410 3600 5310 What a syntax for something simple!\001 +4 0 4 50 -1 0 28 0.0000 4 420 6735 3870 5760 and it doesn't even work quite right\001 +4 0 1 50 -1 0 27 0.0000 4 420 5085 2520 -270 You can do this in a library!\001 +4 0 1 50 -1 0 27 0.0000 4 315 4800 2520 -720 Not a built in Rust feature.\001 -- 2.30.2