[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:honu-in in]
[literal:semicolon %semicolon]
[literal:honu-comma %comma]
[literal:honu-comma %comma]
[literal:honu-comma honu-comma]
[literal:honu-$ $]
[literal:honu-<- <-]
[literal:honu-in-lines inLines]

View File

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

View File

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

View File

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