dev-srcloc
Matthew Butterick 8 years ago
parent 1c3f8781f7
commit 72bbaa6d53

@ -2,8 +2,8 @@
(require json (for-syntax br/datum racket/string)) (require json (for-syntax br/datum racket/string))
(provide (rename-out [jsonic-mb #%module-begin]) (provide (rename-out [jsonic-mb #%module-begin])
jsonic-program jsonic-program
char other-char
s-val) s-exp)
(define-macro (jsonic-mb PARSE-TREE) (define-macro (jsonic-mb PARSE-TREE)
#'(#%module-begin #'(#%module-begin
@ -14,7 +14,7 @@
(define-macro (jsonic-program STR ...) (define-macro (jsonic-program STR ...)
#'(string-append STR ...)) #'(string-append STR ...))
(define-macro (char STR) (define-macro (other-char STR)
#'STR) #'STR)
(define (stringify result) (define (stringify result)
@ -26,7 +26,7 @@
(format "~a: ~a" (stringify k) (stringify v))) ", "))] (format "~a: ~a" (stringify k) (stringify v))) ", "))]
[else ""])) [else ""]))
(define-macro (s-val STR ...) (define-macro (s-exp STR ...)
(define s-exp-string (define s-exp-string
(string-join (map syntax->datum (syntax->list #'(STR ...))) "")) (string-join (map syntax->datum (syntax->list #'(STR ...))) ""))
(with-pattern ([DATUM (format-datum '~a s-exp-string)]) (with-pattern ([DATUM (format-datum '~a s-exp-string)])

@ -1,4 +1,4 @@
#lang brag #lang brag
jsonic-program: (char | s-val)* jsonic-program: (other-char | s-exp)*
char: CHAR other-char: CHAR
s-val: /OPEN CHAR* /CLOSE s-exp: /OPEN CHAR* /CLOSE
Loading…
Cancel
Save