Add descriptions to for: syntax classes.
Closes PR 13284.
This commit is contained in:
parent
d7f12d93f4
commit
38409e0d7e
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
;; intersperses "#:when #t" clauses to emulate the for* variants' semantics
|
;; intersperses "#:when #t" clauses to emulate the for* variants' semantics
|
||||||
(define-splicing-syntax-class for-clause
|
(define-splicing-syntax-class for-clause
|
||||||
|
#:description "for clause"
|
||||||
;; single-valued seq-expr
|
;; single-valued seq-expr
|
||||||
(pattern (~and c (var:optionally-annotated-name seq-expr:expr))
|
(pattern (~and c (var:optionally-annotated-name seq-expr:expr))
|
||||||
#:with (expand ...) #`(#,(syntax/loc #'c
|
#:with (expand ...) #`(#,(syntax/loc #'c
|
||||||
|
@ -25,3 +26,18 @@
|
||||||
(pattern (~seq (~and kw (~or #:when #:unless #:break #:final)) guard:expr)
|
(pattern (~seq (~and kw (~or #:when #:unless #:break #:final)) guard:expr)
|
||||||
#:with (expand ...) (list #'kw #'guard)
|
#:with (expand ...) (list #'kw #'guard)
|
||||||
#:with (expand* ...) #'(expand ...)))
|
#:with (expand* ...) #'(expand ...)))
|
||||||
|
|
||||||
|
(define-syntax-class for-clauses
|
||||||
|
#:description "for clauses"
|
||||||
|
#:attributes ((expand 2) (expand* 2))
|
||||||
|
(pattern (:for-clause ...)))
|
||||||
|
|
||||||
|
(define-syntax-class accumulator-binding
|
||||||
|
#:description "accumumulator binding"
|
||||||
|
#:attributes (ann-name init ty)
|
||||||
|
(pattern (:annotated-name init:expr)))
|
||||||
|
|
||||||
|
(define-syntax-class accumulator-bindings
|
||||||
|
#:description "accumumulator bindings"
|
||||||
|
#:attributes ((ann-name 1) (init 1) (ty 1))
|
||||||
|
(pattern (:accumulator-binding ...)))
|
||||||
|
|
|
@ -791,7 +791,7 @@ This file defines two sorts of primitives. All of them are provided into any mod
|
||||||
(lambda (stx)
|
(lambda (stx)
|
||||||
(syntax-parse stx #:literals (:)
|
(syntax-parse stx #:literals (:)
|
||||||
[(_ a:optional-standalone-annotation
|
[(_ a:optional-standalone-annotation
|
||||||
(clause:for-clause ...)
|
clause:for-clauses
|
||||||
c ...) ; c is not always an expression, can be a break-clause
|
c ...) ; c is not always an expression, can be a break-clause
|
||||||
(maybe-annotate-body
|
(maybe-annotate-body
|
||||||
(quasisyntax/loc stx
|
(quasisyntax/loc stx
|
||||||
|
@ -823,7 +823,7 @@ This file defines two sorts of primitives. All of them are provided into any mod
|
||||||
(syntax-parse stx #:literals (:)
|
(syntax-parse stx #:literals (:)
|
||||||
[(_ : ty
|
[(_ : ty
|
||||||
((var:optionally-annotated-name) ...)
|
((var:optionally-annotated-name) ...)
|
||||||
(clause:for-clause ...)
|
clause:for-clauses
|
||||||
c ...) ; c is not always an expression, can be a break-clause
|
c ...) ; c is not always an expression, can be a break-clause
|
||||||
(syntax-property
|
(syntax-property
|
||||||
(quasisyntax/loc stx
|
(quasisyntax/loc stx
|
||||||
|
@ -833,7 +833,7 @@ This file defines two sorts of primitives. All of them are provided into any mod
|
||||||
'type-ascription
|
'type-ascription
|
||||||
#'ty)]
|
#'ty)]
|
||||||
[(_ ((var:annotated-name) ...)
|
[(_ ((var:annotated-name) ...)
|
||||||
(clause:for-clause ...)
|
clause:for-clauses
|
||||||
c ...)
|
c ...)
|
||||||
(syntax-property
|
(syntax-property
|
||||||
(quasisyntax/loc stx
|
(quasisyntax/loc stx
|
||||||
|
@ -846,7 +846,7 @@ This file defines two sorts of primitives. All of them are provided into any mod
|
||||||
(syntax-parse stx #:literals (:)
|
(syntax-parse stx #:literals (:)
|
||||||
[(_ : ty
|
[(_ : ty
|
||||||
((var:optionally-annotated-name init:expr) ...)
|
((var:optionally-annotated-name init:expr) ...)
|
||||||
(clause:for-clause ...)
|
clause:for-clauses
|
||||||
c ...) ; c is not always an expression, can be a break-clause
|
c ...) ; c is not always an expression, can be a break-clause
|
||||||
(syntax-property
|
(syntax-property
|
||||||
(quasisyntax/loc stx
|
(quasisyntax/loc stx
|
||||||
|
@ -855,22 +855,22 @@ This file defines two sorts of primitives. All of them are provided into any mod
|
||||||
c ...))
|
c ...))
|
||||||
'type-ascription
|
'type-ascription
|
||||||
#'ty)]
|
#'ty)]
|
||||||
[(_ ((var:annotated-name init:expr) ...)
|
[(_ accum:accumulator-bindings
|
||||||
(clause:for-clause ...)
|
clause:for-clauses
|
||||||
c ...)
|
c ...)
|
||||||
(syntax-property
|
(syntax-property
|
||||||
(quasisyntax/loc stx
|
(quasisyntax/loc stx
|
||||||
(for/fold ((var.ann-name init) ...)
|
(for/fold ((accum.ann-name accum.init) ...)
|
||||||
(clause.expand ... ...)
|
(clause.expand ... ...)
|
||||||
c ...))
|
c ...))
|
||||||
'type-ascription
|
'type-ascription
|
||||||
#'(values var.ty ...))]))
|
#'(values accum.ty ...))]))
|
||||||
|
|
||||||
|
|
||||||
(define-syntax (for*: stx)
|
(define-syntax (for*: stx)
|
||||||
(syntax-parse stx #:literals (:)
|
(syntax-parse stx #:literals (:)
|
||||||
[(_ (~seq : Void) ...
|
[(_ (~seq : Void) ...
|
||||||
(clause:for-clause ...)
|
clause:for-clauses
|
||||||
c ...) ; c is not always an expression, can be a break-clause
|
c ...) ; c is not always an expression, can be a break-clause
|
||||||
(quasisyntax/loc stx
|
(quasisyntax/loc stx
|
||||||
(for: (clause.expand* ... ...)
|
(for: (clause.expand* ... ...)
|
||||||
|
@ -881,7 +881,7 @@ This file defines two sorts of primitives. All of them are provided into any mod
|
||||||
(lambda (stx)
|
(lambda (stx)
|
||||||
(syntax-parse stx #:literals (:)
|
(syntax-parse stx #:literals (:)
|
||||||
[(_ a:optional-standalone-annotation
|
[(_ a:optional-standalone-annotation
|
||||||
(clause:for-clause ...)
|
clause:for-clauses
|
||||||
c ...) ; c is not always an expression, can be a break-clause
|
c ...) ; c is not always an expression, can be a break-clause
|
||||||
(maybe-annotate-body
|
(maybe-annotate-body
|
||||||
(quasisyntax/loc stx
|
(quasisyntax/loc stx
|
||||||
|
@ -907,7 +907,7 @@ This file defines two sorts of primitives. All of them are provided into any mod
|
||||||
(syntax-parse stx #:literals (:)
|
(syntax-parse stx #:literals (:)
|
||||||
[(_ : ty
|
[(_ : ty
|
||||||
((var:optionally-annotated-name) ...)
|
((var:optionally-annotated-name) ...)
|
||||||
(clause:for-clause ...)
|
clause:for-clauses
|
||||||
c ...) ; c is not always an expression, can be a break-clause
|
c ...) ; c is not always an expression, can be a break-clause
|
||||||
(syntax-property
|
(syntax-property
|
||||||
(quasisyntax/loc stx
|
(quasisyntax/loc stx
|
||||||
|
@ -917,7 +917,7 @@ This file defines two sorts of primitives. All of them are provided into any mod
|
||||||
'type-ascription
|
'type-ascription
|
||||||
#'ty)]
|
#'ty)]
|
||||||
[(_ ((var:annotated-name) ...)
|
[(_ ((var:annotated-name) ...)
|
||||||
(clause:for-clause ...)
|
clause:for-clauses
|
||||||
c ...)
|
c ...)
|
||||||
(syntax-property
|
(syntax-property
|
||||||
(quasisyntax/loc stx
|
(quasisyntax/loc stx
|
||||||
|
@ -930,7 +930,7 @@ This file defines two sorts of primitives. All of them are provided into any mod
|
||||||
(syntax-parse stx #:literals (:)
|
(syntax-parse stx #:literals (:)
|
||||||
[(_ : ty
|
[(_ : ty
|
||||||
((var:optionally-annotated-name init:expr) ...)
|
((var:optionally-annotated-name init:expr) ...)
|
||||||
(clause:for-clause ...)
|
clause:for-clauses
|
||||||
c ...) ; c is not always an expression, can be a break-clause
|
c ...) ; c is not always an expression, can be a break-clause
|
||||||
(syntax-property
|
(syntax-property
|
||||||
(quasisyntax/loc stx
|
(quasisyntax/loc stx
|
||||||
|
@ -940,7 +940,7 @@ This file defines two sorts of primitives. All of them are provided into any mod
|
||||||
'type-ascription
|
'type-ascription
|
||||||
#'ty)]
|
#'ty)]
|
||||||
[(_ ((var:annotated-name init:expr) ...)
|
[(_ ((var:annotated-name init:expr) ...)
|
||||||
(clause:for-clause ...)
|
clause:for-clauses
|
||||||
c ...)
|
c ...)
|
||||||
(syntax-property
|
(syntax-property
|
||||||
(quasisyntax/loc stx
|
(quasisyntax/loc stx
|
||||||
|
@ -954,7 +954,7 @@ This file defines two sorts of primitives. All of them are provided into any mod
|
||||||
(lambda (stx)
|
(lambda (stx)
|
||||||
(syntax-parse stx #:literals (:)
|
(syntax-parse stx #:literals (:)
|
||||||
[(_ a:optional-standalone-annotation
|
[(_ a:optional-standalone-annotation
|
||||||
(clause:for-clause ...)
|
clause:for-clauses
|
||||||
c ...) ; c is not always an expression, can be a break-clause
|
c ...) ; c is not always an expression, can be a break-clause
|
||||||
(cond
|
(cond
|
||||||
[(syntax-e #'a.ty)
|
[(syntax-e #'a.ty)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user