match': document var' pattern

This commit is contained in:
Matthew Flatt 2011-03-15 12:25:53 -06:00
parent 03e42ce618
commit 17a1322fe5
3 changed files with 4 additions and 3 deletions

View File

@ -5,6 +5,7 @@
(define grammar "
pat ::= id @match anything, bind identifier
| (VAR id) @match anything, bind identifier
| _ @match anything
| literal @match literal
| (QUOTE datum) @match equal% value

View File

@ -65,7 +65,7 @@
rx-expr px-expr pred-expr
derived-pattern)
(match-nonterm (symbol->string s))]
[(QUOTE LIST LIST-REST LIST-NO-ORDER VECTOR HASH-TABLE BOX STRUCT
[(QUOTE VAR LIST LIST-REST LIST-NO-ORDER VECTOR HASH-TABLE BOX STRUCT
REGEXP PREGEXP AND OR NOT APP ? QUASIQUOTE CONS MCONS)
(make-element symbol-color (list (string-downcase (symbol->string s))))]
[(***)

View File

@ -46,11 +46,11 @@ In more detail, patterns match as follows:
@itemize[
@item{@racket[_id], excluding the reserved names @racketidfont{_},
@item{@racket[_id] (excluding the reserved names @racketidfont{_},
@racketidfont{...}, @racketidfont{.._},
@racketidfont{..}@racket[_k], and
@racketidfont{..}@racket[_k] for non-negative integers
@racket[_k] --- matches anything, and binds @racket[id] to the
@racket[_k]) or @racket[(var _id)] --- matches anything, and binds @racket[id] to the
matching values. If an @racket[_id] is used multiple times
within a pattern, the corresponding matches must be the same
according to @racket[(match-equality-test)], except that