You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
beautiful-racket/beautiful-racket-demo/jsonic-demo/expander.rkt

22 lines
650 B
Racket

#lang br/quicklang
(require json)
(define-macro (jsonic-mb PARSE-TREE)
#'(#%module-begin
(define result-string PARSE-TREE)
(define validated-jsexpr (string->jsexpr result-string))
(display result-string)))
(provide (rename-out [jsonic-mb #%module-begin]))
(define-macro (jsonic-char CHAR-TOK-VALUE)
#'CHAR-TOK-VALUE)
(provide jsonic-char)
(define-macro (jsonic-program SEXP-OR-JSON-STR ...)
#'(string-trim (string-append SEXP-OR-JSON-STR ...)))
(provide jsonic-program)
(define-macro (jsonic-sexp SEXP-STR)
(with-pattern ([SEXP-DATUM (format-datum '~a #'SEXP-STR)])
#'(jsexpr->string SEXP-DATUM)))
(provide jsonic-sexp)