better names in jsonic

pull/10/head
Matthew Butterick 8 years ago
parent 2eb46aaa81
commit afa9af72d8

@ -8,15 +8,15 @@
(display result-string))) (display result-string)))
(provide (rename-out [js-module-begin #%module-begin])) (provide (rename-out [js-module-begin #%module-begin]))
(define-macro (jsonic-char CHAR-TOK-VALUE)
#'CHAR-TOK-VALUE)
(provide jsonic-char)
(define-macro (jsonic-program SEXP-OR-JSON-STR ...) (define-macro (jsonic-program SEXP-OR-JSON-STR ...)
#'(string-trim (string-append SEXP-OR-JSON-STR ...))) #'(string-trim (string-append SEXP-OR-JSON-STR ...)))
(provide jsonic-program) (provide jsonic-program)
(define-macro (json-char CHAR-STR) (define-macro (jsonic-sexp SEXP-STR)
#'CHAR-STR)
(provide json-char)
(define-macro (s-exp SEXP-STR)
(with-pattern ([SEXP-DATUM (format-datum '~a #'SEXP-STR)]) (with-pattern ([SEXP-DATUM (format-datum '~a #'SEXP-STR)])
#'(jsexpr->string SEXP-DATUM))) #'(jsexpr->string SEXP-DATUM)))
(provide s-exp) (provide jsonic-sexp)

@ -8,19 +8,19 @@
(check-equal? (check-equal?
(parse-tree (parse-tree
(apply-tokenizer-maker make-tokenizer "@$ 42 $@")) (apply-tokenizer-maker make-tokenizer "@$ 42 $@"))
'(jsonic-program (s-exp " 42 "))) '(jsonic-program (jsonic-sexp " 42 ")))
(check-equal? (check-equal?
(parse-tree (parse-tree
(apply-tokenizer-maker make-tokenizer "hi")) (apply-tokenizer-maker make-tokenizer "hi"))
'(jsonic-program '(jsonic-program
(json-char "h") (jsonic-char "h")
(json-char "i"))) (jsonic-char "i")))
(check-equal? (check-equal?
(parse-tree (parse-tree
(apply-tokenizer-maker make-tokenizer (apply-tokenizer-maker make-tokenizer
"hi\n// comment\n@$ 42 $@")) "hi\n// comment\n@$ 42 $@"))
'(jsonic-program '(jsonic-program
(json-char "h") (jsonic-char "h")
(json-char "i") (jsonic-char "i")
(json-char "\n") (jsonic-char "\n")
(s-exp " 42 "))) (jsonic-sexp " 42 ")))

@ -1,4 +1,4 @@
#lang brag #lang brag
jsonic-program: (json-char | s-exp)* jsonic-program : (jsonic-char | jsonic-sexp)*
json-char: CHAR-TOK jsonic-char : CHAR-TOK
s-exp: SEXP-TOK jsonic-sexp : SEXP-TOK

@ -8,15 +8,15 @@
(display result-string))) (display result-string)))
(provide (rename-out [js-module-begin #%module-begin])) (provide (rename-out [js-module-begin #%module-begin]))
(define-macro (jsonic-char CHAR-TOK-VALUE)
#'CHAR-TOK-VALUE)
(provide jsonic-char)
(define-macro (jsonic-program SEXP-OR-JSON-STR ...) (define-macro (jsonic-program SEXP-OR-JSON-STR ...)
#'(string-trim (string-append SEXP-OR-JSON-STR ...))) #'(string-trim (string-append SEXP-OR-JSON-STR ...)))
(provide jsonic-program) (provide jsonic-program)
(define-macro (json-char CHAR-STR) (define-macro (jsonic-sexp SEXP-STR)
#'CHAR-STR)
(provide json-char)
(define-macro (s-exp SEXP-STR)
(with-pattern ([SEXP-DATUM (format-datum '~a #'SEXP-STR)]) (with-pattern ([SEXP-DATUM (format-datum '~a #'SEXP-STR)])
#'(jsexpr->string SEXP-DATUM))) #'(jsexpr->string SEXP-DATUM)))
(provide s-exp) (provide jsonic-sexp)

@ -8,19 +8,19 @@
(check-equal? (check-equal?
(parse-tree (parse-tree
(apply-tokenizer-maker make-tokenizer "@$ 42 $@")) (apply-tokenizer-maker make-tokenizer "@$ 42 $@"))
'(jsonic-program (s-exp " 42 "))) '(jsonic-program (jsonic-sexp " 42 ")))
(check-equal? (check-equal?
(parse-tree (parse-tree
(apply-tokenizer-maker make-tokenizer "hi")) (apply-tokenizer-maker make-tokenizer "hi"))
'(jsonic-program '(jsonic-program
(json-char "h") (jsonic-char "h")
(json-char "i"))) (jsonic-char "i")))
(check-equal? (check-equal?
(parse-tree (parse-tree
(apply-tokenizer-maker make-tokenizer (apply-tokenizer-maker make-tokenizer
"hi\n// comment\n@$ 42 $@")) "hi\n// comment\n@$ 42 $@"))
'(jsonic-program '(jsonic-program
(json-char "h") (jsonic-char "h")
(json-char "i") (jsonic-char "i")
(json-char "\n") (jsonic-char "\n")
(s-exp " 42 "))) (jsonic-sexp " 42 ")))

@ -1,4 +1,4 @@
#lang brag #lang brag
jsonic-program: (json-char | s-exp)* jsonic-program : (jsonic-char | jsonic-sexp)*
json-char: CHAR-TOK jsonic-char : CHAR-TOK
s-exp: SEXP-TOK jsonic-sexp : SEXP-TOK

@ -8,15 +8,15 @@
(display result-string))) (display result-string)))
(provide (rename-out [js-module-begin #%module-begin])) (provide (rename-out [js-module-begin #%module-begin]))
(define-macro (jsonic-char CHAR-TOK-VALUE)
#'CHAR-TOK-VALUE)
(provide jsonic-char)
(define-macro (jsonic-program SEXP-OR-JSON-STR ...) (define-macro (jsonic-program SEXP-OR-JSON-STR ...)
#'(string-trim (string-append SEXP-OR-JSON-STR ...))) #'(string-trim (string-append SEXP-OR-JSON-STR ...)))
(provide jsonic-program) (provide jsonic-program)
(define-macro (json-char CHAR-STR) (define-macro (jsonic-sexp SEXP-STR)
#'CHAR-STR)
(provide json-char)
(define-macro (s-exp SEXP-STR)
(with-pattern ([SEXP-DATUM (format-datum '~a #'SEXP-STR)]) (with-pattern ([SEXP-DATUM (format-datum '~a #'SEXP-STR)])
#'(jsexpr->string SEXP-DATUM))) #'(jsexpr->string SEXP-DATUM)))
(provide s-exp) (provide jsonic-sexp)

@ -1,4 +1,4 @@
#lang brag #lang brag
jsonic-program: (json-char | s-exp)* jsonic-program : (jsonic-char | jsonic-sexp)*
json-char: CHAR-TOK jsonic-char : CHAR-TOK
s-exp: SEXP-TOK jsonic-sexp : SEXP-TOK

Loading…
Cancel
Save