The following used to work but is currently broken (devel). So maybe wait until 
Araq fixed that. It should be possible to parse the arguments without the 
cumbersome workaround.
    
    
    import macros
    
    macro showArgs(n: varargs[untyped]): untyped =
      for x in n.children:
        if x.kind == nnkExprEqExpr:
          let field = x[0].repr
          case x[1].kind
            of nnkStrLit:
              echo field, ": ", x[1].strVal
            of nnkIntLit:
              echo field, ": ", x[1].intVal
            else:
              echo "not supported"
      
      result = parseStmt("discard")
    
    showArgs(cologne = 4711, foo = "foo the string")
    

Output:
    
    
    cologne: 4711
    foo: foo the string
    

[RunIt](https://glot.io/snippets/eguqi5p9m9)

Reply via email to