-
Notifications
You must be signed in to change notification settings - Fork 2
/
interfaces.scm
201 lines (174 loc) · 8.49 KB
/
interfaces.scm
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
(define-interface utilities-interface
(export mapv mapv! vector-every? copy-vector
initialize-vector vector-append
vfold vfold-right
check-arg
deprecated-proc
real->exact-integer))
(define-interface let-opt-expanders-interface
(export expand-let-optionals
expand-let-optionals*))
(define-interface let-opt-interface
(export (let-optionals :syntax)
(let-optionals* :syntax)
(:optional :syntax)))
(define-interface basic-re-interface
(export (re-dsm? (proc (:value) :boolean))
((re-dsm make-re-dsm) (proc (:value :exact-integer :exact-integer) :value))
(re-dsm:body (proc (:value) :value))
(re-dsm:pre-dsm (proc (:value) :exact-integer))
(re-dsm:tsm (proc (:value) :exact-integer))
(re-dsm:posix (proc (:value) :value))
(set-re-dsm:posix (proc (:value :value) :unspecific))
(re-dsm:post-dsm (proc (:value) :exact-integer))
open-dsm
(re-seq? (proc (:value) :boolean))
(really-make-re-seq (proc (:value :exact-integer :value) :value))
(make-re-seq/tsm (proc (:value :exact-integer) :value))
((re-seq make-re-seq) (proc (:value) :value))
(re-seq:elts (proc (:value) :value))
(re-seq:tsm (proc (:value) :exact-integer))
(re-seq:posix (proc (:value) :value))
(set-re-seq:posix (proc (:value :value) :unspecific))
(re-choice? (proc (:value) :boolean))
(really-make-re-choice (proc (:value :exact-integer :value) :value))
(make-re-choice/tsm (proc (:value :exact-integer) :value))
((make-re-choice re-choice) (proc (:value) :value))
(re-choice:elts (proc (:value) :value))
(re-choice:tsm (proc (:value) :exact-integer))
(re-choice:posix (proc (:value) :value))
(set-re-choice:posix (proc (:value :value) :unspecific))
(re-repeat? (proc (:value) :boolean))
(really-make-re-repeat (proc (:exact-integer
:value :value
:exact-integer :value)
:value))
(make-re-repeat/tsm (proc (:exact-integer :value :value :exact-integer )
:value))
((re-repeat make-re-repeat)
(proc (:exact-integer :value :value) :value))
((re-repeat:from re-repeat:tsm)
(proc (:value) :exact-integer))
(re-repeat:to (proc (:value) :value))
((re-repeat:body re-repeat:posix)
(proc (:value) :value))
(set-re-repeat:posix (proc (:value :value) :unspecific))
(re-submatch? (proc (:value) :boolean))
(really-make-re-submatch (proc (:value :exact-integer :exact-integer :value)
:value))
(make-re-submatch/tsm (proc (:value :exact-integer :exact-integer) :value))
((make-re-submatch re-submatch)
(proc (:value &opt :exact-integer :exact-integer) :value))
(re-submatch:body (proc (:value) :value))
((re-submatch:pre-dsm re-submatch:tsm re-submatch:post-dsm)
(proc (:value) :exact-integer))
(re-submatch:posix (proc (:value) :value))
(set-re-submatch:posix (proc (:value :value) :unspecific))
(re-string? (proc (:value) :boolean))
((make-re-string re-string) (proc (:string) :value))
(re-string:chars (proc (:value) :string))
(set-re-string:chars (proc (:value :string) :unspecific))
(re-string:posix (proc (:value) :value))
(set-re-string:posix (proc (:value :value) :unspecific))
re-trivial
(re-trivial? (proc (:value) :boolean))
(re-char-set? (proc (:value) :boolean))
((make-re-char-set re-char-set) (proc (:value) :value))
(re-char-set:cset (proc (:value) :value))
(set-re-char-set:cset (proc (:value :value) :unspecific))
(re-char-set:posix (proc (:value) :value))
(set-re-char-set:posix (proc (:value :value) :unspecific))
re-empty
(re-empty? (proc (:value) :boolean))
re-bos re-eos
re-bol re-eol
((re-bos? re-eos? re-bol? re-eol? re-any?)
(proc (:value) :boolean))
re-any
re-nonl
(regexp? (proc (:value) :boolean))
(re-tsm (proc (:value) :exact-integer))
;; These guys can be in code produced by RX expander.
(flush-submatches (proc (:value) :value))
(uncase (proc (:value) :value))
(uncase-char-set (proc (:value) :value))
(uncase-string (proc (:string) :value))))
(define-interface re-internals-interface
;; These are constructors for the Scheme unparser
(export
(make-re-string/posix (proc (:string :string :vector) :value))
((make-re-seq/posix make-re-choice/posix)
(proc (:value :exact-integer :string :vector) :value))
(make-re-char-set/posix (proc (:value :string :vector) :value))
(make-re-repeat/posix (proc (:exact-integer :value :value :exact-integer :string :vector)
:value))
(make-re-dsm/posix (proc (:value :exact-integer :exact-integer :string :vector)
:value))
(make-re-submatch/posix (proc (:value :exact-integer :exact-integer :string :vector) :value))))
(define-interface re-match-internals-interface
(export (regexp-match:string (proc (:value) :string))
(regexp-match:submatches (proc (:value) :vector))))
(define-interface posix-re-interface
(export (regexp->posix-string (proc (:value) :string)) ; posixstr.scm
(posix-string->regexp (proc (:string) :value)))) ; spencer
(define-interface re-subst-interface
(export
(regexp-substitute (proc (:value :value &rest :value) :value))
(regexp-substitute/global (proc (:value :value :string &rest :value) :value))))
(define-interface re-folders-interface
(export
(regexp-fold (proc (:value (proc (:exact-integer :value :value) :value)
:value
:string
&opt (proc (:exact-integer :value) :value)
:exact-integer)
:value))
(regexp-fold-right (proc (:value (proc (:value :exact-integer :value) :value)
:value
:string
&opt (proc (:exact-integer :value) :value)
:exact-integer)
:value))
(regexp-for-each (proc (:value (proc (:value) :unspecific)
:string &opt :exact-integer)
:unspecific))))
(define-interface re-level-0-interface
(compound-interface posix-re-interface
basic-re-interface
(export (regexp-match? (proc (:value) :boolean))
(match:start (proc (:value &opt :exact-integer) :value))
(match:end (proc (:value &opt :exact-integer) :value))
(match:substring (proc (:value &opt :exact-integer) :value))
(regexp-search (proc (:value :string &opt :exact-integer)
:value))
(regexp-search? (proc (:value :string &opt :exact-integer)
:boolean))
(sre->regexp (proc (:value) :value))
(regexp->sre (proc (:value) :value))
(simplify-regexp (proc (:value) :value)))))
(define-interface rx-lib-interface
(compound-interface (export coerce-dynamic-regexp
coerce-dynamic-charset
spec->char-set
flush-submatches
uncase
uncase-char-set
uncase-string)
re-internals-interface))
(define-interface rx-syntax-interface (export (rx :syntax)))
(define-interface sre-syntax-tools-interface
(export (if-sre-form :syntax)
sre-form?
parse-sre parse-sres
regexp->scheme
static-regexp?))
(define-interface re-match-syntax-interface
(export (let-match :syntax)
(if-match :syntax)
(match-cond :syntax)))
(define-interface re-exports-interface
(compound-interface re-level-0-interface
rx-syntax-interface
re-subst-interface
re-match-syntax-interface
re-folders-interface))