boot2

Playing with the boostrap
git clone https://git.ryansepassi.com/git/boot2.git
Log | Files | Refs | README

06-paste.M1pp (522B)


      1 # `##` paste compaction inside macro bodies.
      2 #  - param ## param (basic)
      3 #  - literal ## param  /  param ## literal
      4 #  - chain: a ## b ## c (paste compactor processes left-to-right)
      5 #  - multiple params on one body line, only some adjacent to ##
      6 
      7 %macro PP(a, b)
      8 a ## b
      9 %endm
     10 
     11 %macro PRE(x)
     12 prefix_ ## x
     13 %endm
     14 
     15 %macro SUF(x)
     16 x ## _suffix
     17 %endm
     18 
     19 %macro CHAIN(a, b, c)
     20 a ## b ## c
     21 %endm
     22 
     23 %macro MIX(a, b)
     24 a normal_ ## b a_ ## a
     25 %endm
     26 
     27 %PP(HELLO, _WORLD)
     28 %PRE(name)
     29 %SUF(name)
     30 %CHAIN(one, _two, _three)
     31 %MIX(LEFT, RIGHT)
     32 END