[honu] filter out non-pattern variables

This commit is contained in:
Jon Rafkind 2011-11-14 11:19:37 -07:00
parent 0d89827a85
commit 9d393f991f
2 changed files with 5 additions and 2 deletions

View File

@ -42,7 +42,7 @@
[pattern x #:with result #f])
(syntax-parse original-pattern
[(thing:pattern-type ...)
(filter (lambda (x) x) (syntax->list #'(thing.result ...)))]))
(filter (lambda (x) (syntax-e x)) (syntax->list #'(thing.result ...)))]))
(provide honu-macro)
(define-honu-syntax honu-macro
@ -51,6 +51,7 @@
(syntax-parse code #:literal-sets (cruft)
[(_ name literals (#%braces pattern ...) (#%braces action ...) . rest)
(debug "Pattern is ~a\n" #'(pattern ...))
(debug 2 "Pattern variables ~a\n" (find-pattern-variables #'(pattern ...)))
(values
(with-syntax ([(syntax-parse-pattern ...)
(convert-pattern #'(pattern ...))]
@ -68,7 +69,8 @@
;; instead of x_result. x_result is still there, too
(with-syntax ([pattern-variable.name #'pattern-variable.result]
...)
(code ...)) #'more #t)])))))
(code ...))
#'more #t)])))))
#'rest
#t)])))

View File

@ -23,6 +23,7 @@
null?
length
substring
void
(rename-out [honu-cond cond]
[null empty]
[current-inexact-milliseconds currentMilliseconds]