syntax/parse: exported and documented ~do action pattern
This commit is contained in:
parent
c51f769672
commit
b8fc41283e
|
@ -15,7 +15,6 @@
|
|||
syntax-parser
|
||||
|
||||
(except-out (all-from-out "keywords.rkt")
|
||||
~do
|
||||
~reflect
|
||||
~splicing-reflect
|
||||
~eh-var)
|
||||
|
|
|
@ -32,7 +32,7 @@ means specifically @tech{@Spattern}.
|
|||
|
||||
@schemegrammar*[#:literals (_ ~var ~literal ~or ~and ~not ~rest ~datum
|
||||
~describe ~seq ~optional ~rep ~once ~between
|
||||
~! ~bind ~fail ~parse ~peek ~peek-not)
|
||||
~! ~bind ~fail ~parse ~peek ~peek-not ~do)
|
||||
[S-pattern
|
||||
pvar-id
|
||||
pvar-id:syntax-class-id
|
||||
|
@ -90,7 +90,8 @@ means specifically @tech{@Spattern}.
|
|||
(~bind [attr-arity-decl expr] ...)
|
||||
(~fail maybe-fail-condition maybe-message-expr)
|
||||
(~parse S-pattern stx-expr)
|
||||
(@#,ref[~and a] A-pattern ...+)]
|
||||
(@#,ref[~and a] A-pattern ...+)
|
||||
(~do defn-or-expr ...)]
|
||||
[proper-S-pattern
|
||||
#, @elem{a @svar{S-pattern} that is not a @svar{A-pattern}}]
|
||||
[proper-H-pattern
|
||||
|
@ -953,3 +954,20 @@ Evaluates @scheme[stx-expr] to a syntax object and matches it against
|
|||
|
||||
Performs the actions of each @scheme[A-pattern].
|
||||
}
|
||||
|
||||
@specsubform[(@#,defhere[~do] defn-or-expr ...)]{
|
||||
|
||||
Takes a sequence of definitions and expressions, which may be
|
||||
intermixed, and evaluates them in the scope of all previous attribute
|
||||
bindings. The names bound by the definitions are in scope in the
|
||||
expressions of subsequent patterns and clauses.
|
||||
|
||||
There is currently no way to bind attributes using a @scheme[~do]
|
||||
pattern. It is an error to shadow an attribute binding with a
|
||||
definition in a @scheme[~do] block.
|
||||
|
||||
@myexamples[
|
||||
(syntax-parse #'(1 2 3)
|
||||
[(a b (~do (printf "a was ~s\n" #'a)) c:id) 'ok])
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user