parser test
parent
b6a45815ab
commit
747e59ebc5
@ -1,4 +1,24 @@
|
|||||||
#lang brag
|
#lang br
|
||||||
jsonic-program: (s-exp | json-char)*
|
(require br/demo/jsonic-2/parser
|
||||||
s-exp: SEXP-TOK
|
br/demo/jsonic-2/tokenizer
|
||||||
json-char: CHAR-TOK
|
brag/support
|
||||||
|
rackunit)
|
||||||
|
|
||||||
|
(check-equal?
|
||||||
|
(parse-tree (apply-tokenizer tokenize "// line commment\n"))
|
||||||
|
'(jsonic-program))
|
||||||
|
(check-equal?
|
||||||
|
(parse-tree (apply-tokenizer tokenize "@$ 42 $@"))
|
||||||
|
'(jsonic-program (s-exp " 42 ")))
|
||||||
|
(check-equal?
|
||||||
|
(parse-tree (apply-tokenizer tokenize "hi"))
|
||||||
|
'(jsonic-program
|
||||||
|
(json-char "h")
|
||||||
|
(json-char "i")))
|
||||||
|
(check-equal?
|
||||||
|
(parse-tree (apply-tokenizer tokenize "hi\n// comment\n@$ 42 $@"))
|
||||||
|
'(jsonic-program
|
||||||
|
(json-char "h")
|
||||||
|
(json-char "i")
|
||||||
|
(json-char "\n")
|
||||||
|
(s-exp " 42 ")))
|
Loading…
Reference in New Issue