syntax/parse: added #:when back

svn: r15980
This commit is contained in:
Ryan Culpepper 2009-09-11 19:48:33 +00:00
parent 538cc8862f
commit 7e4c6162a0
2 changed files with 16 additions and 1 deletions

View File

@ -689,6 +689,10 @@
[(cons (list '#:fail-unless fu-stx unless-condition expr) rest)
(cons (make clause:fail #`(not #,unless-condition) expr)
(parse-pattern-sides rest decls))]
[(cons (list '#:when unless-condition) rest)
;; Bleh: when is basically fail-unless without the msg argument
(cons (make clause:fail #`(not #,unless-condition) #'#f)
(parse-pattern-sides rest decls))]
[(cons (list '#:with with-stx pattern expr) rest)
(let-values ([(decls2 rest) (grab-decls rest decls)])
(let-values ([(decls2a defs) (decls-create-defs decls2)])
@ -876,6 +880,7 @@
(list (list '#:declare check-identifier check-expression)
(list '#:fail-when check-expression check-expression)
(list '#:fail-unless check-expression check-expression)
(list '#:when check-expression)
(list '#:with check-expression check-expression)
(list '#:attr check-attr-arity check-expression)))

View File

@ -603,7 +603,8 @@ conditions. The grammar for pattern directives follows:
(code:line #:with syntax-pattern expr)
(code:line #:attr attr-id expr)
(code:line #:fail-when condition-expr message-expr)
(code:line #:fail-unless condition-expr message-expr)]
(code:line #:fail-unless condition-expr message-expr)
(code:line #:when condition-expr)]
@specsubform[(code:line #:declare pvar-id syntax-class-id)]
@specsubform[(code:line #:declare pvar-id (syntax-class-id expr ...))]{
@ -650,6 +651,15 @@ given message); otherwise, it continues.
}
@specsubform[(code:line #:when condition-expr)]{
Evaluates the @scheme[condition-expr] in the context of all previous
attribute bindings. If the value is @scheme[#f], the matching process
backtracks. In other words, @scheme[#:when] is like
@scheme[#:fail-unless] without the message argument.
}
@deftogether[[
@defidform[~or]
@defidform[~and]