boot2

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

09-args.M1pp (634B)


      1 # Argument parsing edge cases for parse_args:
      2 #  - nested parens in an arg (depth tracking)
      3 #  - commas only split at depth 1 (commas inside nested parens stay in the arg)
      4 #  - 0-param macro called with ()
      5 #  - macro at the 16-param edge
      6 #  - string token containing a comma is one TOK_STRING, not a split point
      7 
      8 %macro NULLARY()
      9 ok
     10 %endm
     11 
     12 %macro TWO(a, b)
     13 [ a | b ]
     14 %endm
     15 
     16 %macro SIXTEEN(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p)
     17 < a b c d e f g h i j k l m n o p >
     18 %endm
     19 
     20 %NULLARY()
     21 %TWO((nested, parens, here), trailing)
     22 %TWO((1 2 (3 4) 5), other)
     23 %TWO("string with, comma", x)
     24 %SIXTEEN(t1,t2,t3,t4,t5,t6,t7,t8,t9,tA,tB,tC,tD,tE,tF,tG)
     25 END