File: contract.rkt

package info (click to toggle)
racket 7.9%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 178,684 kB
  • sloc: ansic: 282,112; lisp: 234,887; pascal: 70,954; sh: 27,112; asm: 16,268; makefile: 4,613; cpp: 2,715; ada: 1,681; javascript: 1,244; cs: 879; exp: 499; csh: 422; python: 274; xml: 106; perl: 104
file content (46 lines) | stat: -rw-r--r-- 1,964 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#lang racket/base
(require syntax/parse/pre
         "provide.rkt"
         syntax/contract
         (only-in syntax/parse/private/residual ;; keep abs. path
                  this-context-syntax
                  this-role)
         racket/contract/base)

(define not-given (gensym))

(define-syntax-class (expr/c ctc-stx
                             #:arg? [arg? #t]
                             #:positive [pos-blame 'from-macro]
                             #:negative [neg-blame 'use-site]
                             #:macro [macro-name #f]
                             #:name [expr-name not-given]
                             #:context [ctx #f]
                             #:phase [phase (syntax-local-phase-level)])
  #:attributes (c)
  #:commit
  (pattern y:expr
           #:with
           c (wrap-expr/c ctc-stx
                          #'y
                          #:arg? arg?
                          #:positive pos-blame
                          #:negative neg-blame
                          #:name (if (eq? expr-name not-given)
                                     this-role
                                     expr-name)
                          #:macro macro-name
                          #:context (or ctx (this-context-syntax))
                          #:phase phase)))

(provide-syntax-class/contract
 [expr/c (syntax-class/c (syntax?)
                         (#:arg? any/c
                          #:positive (or/c syntax? string? module-path-index?
                                           'from-macro 'use-site 'unknown)
                          #:negative (or/c syntax? string? module-path-index?
                                           'from-macro 'use-site 'unknown)
                          #:name (or/c identifier? string? symbol? #f)
                          #:macro (or/c identifier? string? symbol? #f)
                          #:context (or/c syntax? #f)
                          #:phase exact-integer?))])