From b51ab5802a4cff41b2251bba7b6409fc40b6569c Mon Sep 17 00:00:00 2001 From: Jon Rafkind Date: Thu, 19 Apr 2012 17:05:30 -0600 Subject: [PATCH] [honu] replace $ with honu-$ just to be safe --- collects/honu/core/main.rkt | 2 +- collects/honu/core/private/compile.rkt | 10 +++++++--- collects/honu/core/read.rkt | 3 ++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/collects/honu/core/main.rkt b/collects/honu/core/main.rkt index f473939e39..4a9b8bb2e3 100644 --- a/collects/honu/core/main.rkt +++ b/collects/honu/core/main.rkt @@ -77,7 +77,7 @@ [literal:honu-in in] [literal:semicolon %semicolon] [literal:honu-comma honu-comma] - [literal:honu-$ $] + [literal:honu-$ honu-$] [literal:honu-<- <-] [literal:honu-in-lines inLines] [literal:#%brackets #%brackets] diff --git a/collects/honu/core/private/compile.rkt b/collects/honu/core/private/compile.rkt index 8c704234ff..fb0bc55118 100644 --- a/collects/honu/core/private/compile.rkt +++ b/collects/honu/core/private/compile.rkt @@ -123,15 +123,19 @@ (define-literal-set local-literals (honu-$ repeat$)) (define-splicing-syntax-class not-dollar #:literal-sets (local-literals) - [pattern x #:when (and (identifier? #'x) - (not (free-identifier=? #'honu-$ #'x))) + [pattern x #:when (or (not (identifier? #'x)) + (not (free-identifier=? #'honu-$ #'x))) #:with out #'x]) + (debug 2 "Compress dollars ~a\n" stx) (syntax-parse stx #:literal-sets (local-literals) [(honu-$ x:not-dollar ... honu-$ rest ...) + (debug 2 "Compressing ~a\n" #'(x.out ...)) (with-syntax ([(rest* ...) (compress-dollars #'(rest ...))]) (datum->syntax stx (syntax->list #'((repeat$ x.out ...) rest* ...)) stx stx))] - [(x:not-dollar rest ...) + [(honu-$ rest ...) + (error 'compress-dollars "unmatched $ ~a" (syntax->datum stx))] + [(x rest ...) (with-syntax ([x* (compress-dollars #'x)] [(rest* ...) (compress-dollars #'(rest ...))]) (datum->syntax stx diff --git a/collects/honu/core/read.rkt b/collects/honu/core/read.rkt index f55d446572..7a9a5e01c9 100644 --- a/collects/honu/core/read.rkt +++ b/collects/honu/core/read.rkt @@ -38,7 +38,7 @@ (define-lex-abbrev string (:: #\" (:* string-character) #\")) (define-lex-abbrev operator (:or "+=" "-=" "*=" "/=" "+" "!=" "=>" "=" "==" "*" "/" "-" "^" "||" "|" "&&" "<=" - ">=" "<-" "<" ">" "!" "::" ":=" "%" "$")) + ">=" "<-" "<" ">" "!" "::" ":=" "%")) (define-lex-abbrev block-comment (:: "/*" (complement (:: any-string "*/" any-string)) "*/")) @@ -71,6 +71,7 @@ ["/*" (token-block-comment)] ["..." (token-identifier '...)] ["." (token-identifier '%dot)] + ["$" (token-identifier 'honu-$)] ["," (token-identifier 'honu-comma)] [":" (token-identifier '%colon)] ["'" (token-identifier 'quote)]