[honu] always reparse the output of honu-expression. provide honu-comma so that it works with literal sets

This commit is contained in:
Jon Rafkind 2012-04-06 12:35:52 -06:00
parent 6531ce7547
commit bbc806732c
4 changed files with 11 additions and 12 deletions

View File

@ -76,8 +76,7 @@
[literal:colon %colon] [literal:colon %colon]
[literal:honu-in in] [literal:honu-in in]
[literal:semicolon %semicolon] [literal:semicolon %semicolon]
[literal:honu-comma %comma] [literal:honu-comma honu-comma]
[literal:honu-comma %comma]
[literal:honu-$ $] [literal:honu-$ $]
[literal:honu-<- <-] [literal:honu-<- <-]
[literal:honu-in-lines inLines] [literal:honu-in-lines inLines]

View File

@ -334,9 +334,8 @@
(syntax-parse code #:literal-sets (cruft) (syntax-parse code #:literal-sets (cruft)
[(var:honu-declaration . rest) [(var:honu-declaration . rest)
(define result (define result
(with-syntax ([var.expression (honu->racket #'var.expression)])
;; wrap the expression in a let so that we can insert new `define-syntax'es ;; wrap the expression in a let so that we can insert new `define-syntax'es
(racket-syntax (define-values (var.name ...) (let () var.expression))))) (racket-syntax (define-values (var.name ...) (let () var.expression))))
(values result #'rest #t)]))) (values result #'rest #t)])))
(provide (rename-out [honu-with-syntax withSyntax])) (provide (rename-out [honu-with-syntax withSyntax]))

View File

@ -303,6 +303,7 @@
#; #;
(debug "Reparsed output ~a\n" (pretty-format (syntax->datum re-parse))) (debug "Reparsed output ~a\n" (pretty-format (syntax->datum re-parse)))
(define terminate (definition? re-parse)) (define terminate (definition? re-parse))
(debug "Terminate? ~a\n" terminate)
(if terminate? (if terminate?
(values (left re-parse) (values (left re-parse)
#'rest) #'rest)
@ -606,12 +607,12 @@
(define-values (parsed unparsed) (define-values (parsed unparsed)
(parse stx)) (parse stx))
(debug "[~a] expression parsed ~a\n" context (if parsed (syntax->datum parsed) parsed)) (debug "[~a] expression parsed ~a\n" context (if parsed (syntax->datum parsed) parsed))
(debug "[~a] Parsed things ~a\n" context (parsed-things stx unparsed)) (debug 2 "[~a] Parsed things ~a\n" context (parsed-things stx unparsed))
(if (parsed-syntax? parsed)
(list (parsed-things stx unparsed) (list (parsed-things stx unparsed)
(parsed-syntax parsed) (parsed-syntax parsed))
#; (list (parsed-things stx unparsed)
(with-syntax ([parsed parsed]) (parse-all parsed)))))))
#'(%racket parsed)))))))
(provide honu-expression-list) (provide honu-expression-list)
(define-splicing-syntax-class (honu-expression-list) (define-splicing-syntax-class (honu-expression-list)

View File

@ -71,7 +71,7 @@
["/*" (token-block-comment)] ["/*" (token-block-comment)]
["..." (token-identifier '...)] ["..." (token-identifier '...)]
["." (token-identifier '%dot)] ["." (token-identifier '%dot)]
["," (token-identifier '%comma)] ["," (token-identifier 'honu-comma)]
[":" (token-identifier '%colon)] [":" (token-identifier '%colon)]
["'" (token-identifier 'quote)] ["'" (token-identifier 'quote)]
["`" (token-identifier 'quasiquote)] ["`" (token-identifier 'quasiquote)]