From 5ef1a11a2be9e02e2fc4d863ec5df666fede87ed Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Sun, 29 Jan 2017 16:04:05 -0800 Subject: [PATCH] quick fix --- beautiful-racket-demo/basic-demo/colorer.rkt | 51 +------------------- 1 file changed, 1 insertion(+), 50 deletions(-) diff --git a/beautiful-racket-demo/basic-demo/colorer.rkt b/beautiful-racket-demo/basic-demo/colorer.rkt index 4734f74..ad8890e 100644 --- a/beautiful-racket-demo/basic-demo/colorer.rkt +++ b/beautiful-racket-demo/basic-demo/colorer.rkt @@ -1,51 +1,2 @@ #lang br -(require brag/support syntax-color/racket-lexer racket/contract - basic-demo/tokenizer sugar/coerce) - -(define (color-basic ip) - (define postok (basic-lexer ip)) - (define tok (position-token-token postok)) - (define-values (type val) - (cond - [(eof-object? tok) (values eof eof)] - [(string? tok) (values 'string tok)] - [else (values (token-struct-type tok) - (format "~a" (token-struct-val tok)))])) - (values val - (caseq type - [(WHITE) 'white-space] - [(COMMENT) 'comment] - [(NUMBER) 'constant] - [(STRING) 'string] - [else 'keyword]) - #f - (position-offset (position-token-start-pos postok)) - (position-offset (position-token-end-pos postok)))) - - -#;(provide - (contract-out - [color-basic - (input-port? . -> . (values - (or/c string? eof-object?) - symbol? - (or/c symbol? #f) - (or/c exact-positive-integer? #f) - (or/c exact-positive-integer? #f)))])) - -(define (apply-colorer colorer-proc str) - (let loop ([p (open-input-string str)][color-recs empty]) - (define color-rec (values->list (colorer-proc p))) - (if (eof-object? (car color-rec)) - (reverse color-recs) - (loop p (cons color-rec color-recs))))) - -(module+ main - (define str #<