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
634 B
Racket

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