|
|
|
@ -8,11 +8,14 @@
|
|
|
|
|
(cond
|
|
|
|
|
[(symbol? x) (token x #f)]
|
|
|
|
|
[(string? x)
|
|
|
|
|
(map (λ(xi) (token 'QUAD (quad attrs xi))) (string->list x))]
|
|
|
|
|
(for/list ([c (in-string x)])
|
|
|
|
|
(case c
|
|
|
|
|
[(#\space #\newline #\return) (token 'WHITESPACE (quad attrs c))]
|
|
|
|
|
[else (token 'QUAD (quad attrs c))]))]
|
|
|
|
|
[else
|
|
|
|
|
(map (λ(xi) (loop xi ((quad-attrs x) . override-with . attrs))) (quad-list x))]))))
|
|
|
|
|
(map (λ(xi) (loop xi ((quad-attrs x) . override-with . attrs))) (quad-list x))]))))
|
|
|
|
|
|
|
|
|
|
(module+ test
|
|
|
|
|
(require rackunit)
|
|
|
|
|
(require rackunit "parse.rkt")
|
|
|
|
|
(tokenize (quad (attrs #:size 10 #:font "Eq") "ba" (line-break) "r" (quad (attrs #:size 8) "zam") "q\tux"))
|
|
|
|
|
(tokenize (quad #f "Meg is" (block-break) " an ally.")))
|
|
|
|
|
(syntax->datum (parse (tokenize (quad #f "Meg is " (line-break) "\nan ally.")))))
|
|
|
|
|