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.
28 lines
821 B
Racket
28 lines
821 B
Racket
8 years ago
|
#lang racket/base
|
||
3 years ago
|
(require yaragg/examples/baby-json-hider
|
||
|
yaragg/support
|
||
8 years ago
|
rackunit)
|
||
|
|
||
|
(define parse-result (parse (list "{"
|
||
|
(token 'ID "message")
|
||
|
":"
|
||
|
(token 'STRING "'hello world'")
|
||
|
"}")))
|
||
|
(check-equal? (syntax->datum parse-result) '(json (":")))
|
||
|
|
||
|
(define syntaxed-colon-parens (cadr (syntax->list parse-result)))
|
||
|
(check-equal? (syntax->datum (syntax-property syntaxed-colon-parens 'kvpair)) 'kvpair)
|
||
|
|
||
|
(check-equal?
|
||
|
(syntax->datum
|
||
|
(parse "[[[{}]],[],[[{}]]]"))
|
||
7 years ago
|
'(json
|
||
|
(array
|
||
|
"["
|
||
|
(json (array "[" (json (array "[" (json) "]")) "]"))
|
||
|
","
|
||
|
(json (array "[" "]"))
|
||
|
","
|
||
|
(json (array "[" (json (array "[" (json) "]")) "]"))
|
||
|
"]")))
|