macros1.scm 865 B

123456789101112131415161718192021222324252627282930
  1. ;; Complicated macros that used to incorrectly report a cyclic template.
  2. (define-syntax define-labeled-arg-macro
  3. (syntax-rules ()
  4. ((define-labeled-arg-macro
  5. labeled-arg-macro-name
  6. (positional-macro-name
  7. (arg-name . arg-def) ...))
  8. (define-syntax labeled-arg-macro-name
  9. (syntax-rules ()
  10. ((labeled-arg-macro-name . kw-val-pairs)
  11. (let-syntax
  12. ((find
  13. (syntax-rules (arg-name ...)
  14. ((find k-args (arg-name . default) arg-name
  15. val . others)
  16. (next val . k-args)) ...
  17. )))
  18. (next positional-macro-name ()
  19. (arg-name . arg-def) ...))))))))
  20. (define-labeled-arg-macro
  21. make-parser
  22. (make-parser/positional-args
  23. (NEW-LEVEL-SEED)
  24. (PI ())))
  25. (display "ok\n")
  26. ;; Output: ok