|
|
@ -2,17 +2,15 @@
|
|
|
|
(require brag/support syntax-color/racket-lexer racket/contract
|
|
|
|
(require brag/support syntax-color/racket-lexer racket/contract
|
|
|
|
basic-demo/tokenizer sugar/coerce)
|
|
|
|
basic-demo/tokenizer sugar/coerce)
|
|
|
|
|
|
|
|
|
|
|
|
;(values lexeme 'parenthesis '|(| (pos lexeme-start) (pos lexeme-end))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(define (color-basic ip)
|
|
|
|
(define (color-basic ip)
|
|
|
|
(define postok ((tokenize ip)))
|
|
|
|
(define postok ((tokenize ip)))
|
|
|
|
(define tok-or-str (position-token-token postok))
|
|
|
|
(define tok (position-token-token postok))
|
|
|
|
(define type (if (string? tok-or-str)
|
|
|
|
(define-values (type val)
|
|
|
|
'string
|
|
|
|
(cond
|
|
|
|
(token-struct-type tok-or-str)))
|
|
|
|
[(eof-object? tok) (values 'eof "")]
|
|
|
|
(define val (if (string? tok-or-str)
|
|
|
|
[(string? tok) (values 'string tok)]
|
|
|
|
tok-or-str
|
|
|
|
[else (values (token-struct-type tok)
|
|
|
|
(->string (or (token-struct-val tok-or-str) ""))))
|
|
|
|
(format "~a" (token-struct-val tok)))]))
|
|
|
|
(values val
|
|
|
|
(values val
|
|
|
|
(caseq type
|
|
|
|
(caseq type
|
|
|
|
[(WHITE) 'white-space]
|
|
|
|
[(WHITE) 'white-space]
|
|
|
|