nendo 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/init.nnd +7 -5
- data/lib/init.nndc +2078 -1997
- data/lib/nendo/experimental.nnd +58 -0
- data/lib/nendo/experimental.nndc +2614 -3
- data/lib/nendo/test.nnd +40 -8
- data/lib/nendo/test.nndc +704 -361
- data/lib/nendo.rb +29 -3
- data/lib/rfc/json.nndc +6 -6
- data/lib/srfi-1.nndc +147 -147
- data/lib/srfi-2.nndc +90 -90
- data/lib/srfi-26.nndc +251 -251
- data/lib/text/html-lite.nndc +23 -23
- data/lib/util/combinations.nndc +191 -191
- data/lib/util/list.nnd +2 -0
- data/lib/util/list.nndc +692 -609
- data/lib/util/match.nndc +5551 -5551
- data/test/nendo_spec.rb +19 -3
- data/test/syntax_spec.rb +339 -15
- data/test/testframework_spec.rb +153 -0
- data/test/util-list-test.nnd +6 -6
- metadata +6 -5
data/lib/nendo/experimental.nnd
CHANGED
@@ -118,3 +118,61 @@
|
|
118
118
|
(assv-ref "expanded" alist))))))))
|
119
119
|
|
120
120
|
|
121
|
+
(define-syntax raise
|
122
|
+
(syntax-rules ()
|
123
|
+
((raise)
|
124
|
+
(error "raise requires (raise exception message [backtrace-str])"))
|
125
|
+
((raise exc)
|
126
|
+
(%raise exc
|
127
|
+
(sprintf "%s:%s raised %s" (*FILE*) (*LINE*) exc)
|
128
|
+
(sprintf "%s:%s raised %s" (*FILE*) (*LINE*) exc)))
|
129
|
+
((raise exc mes)
|
130
|
+
(%raise exc mes (sprintf "%s:%s raised %s" (*FILE*) (*LINE*) exc)))
|
131
|
+
((raise exc mes backtrace)
|
132
|
+
(%raise exc mes backtrace))))
|
133
|
+
|
134
|
+
|
135
|
+
;; guard for Exceptions
|
136
|
+
(define-syntax %guard-var
|
137
|
+
(syntax-rules (=> ...)
|
138
|
+
((%guard-clause (var clauses ...))
|
139
|
+
var)))
|
140
|
+
|
141
|
+
(define-syntax %guard-clause
|
142
|
+
(syntax-rules (=> ...)
|
143
|
+
((%guard-clause (var clauses ...))
|
144
|
+
(cond
|
145
|
+
clauses ...))))
|
146
|
+
|
147
|
+
(define-syntax guard
|
148
|
+
(syntax-rules ()
|
149
|
+
((guard)
|
150
|
+
(error "guard requires (guard (var (clauses-like-cond)) body ...)"))
|
151
|
+
((guard var-clauses)
|
152
|
+
(error "guard requires (guard (var (clauses-like-cond)) body ...)"))
|
153
|
+
((guard var-clauses body ...)
|
154
|
+
(%guard
|
155
|
+
(%guard-var
|
156
|
+
var-clauses)
|
157
|
+
(%guard-clause
|
158
|
+
var-clauses)
|
159
|
+
body ...))))
|
160
|
+
|
161
|
+
|
162
|
+
;; unwind-protect for Exceptions
|
163
|
+
(define-syntax unwind-protect
|
164
|
+
(syntax-rules ()
|
165
|
+
((unwind-protect)
|
166
|
+
(error "unwind-protect requires (unwind-protect body cleanup) form."))
|
167
|
+
((unwind-protect body)
|
168
|
+
(error "unwind-protect requires (unwind-protect body cleanup) form."))
|
169
|
+
((unwind-protect body cleanup)
|
170
|
+
(let1 temp #f
|
171
|
+
(guard
|
172
|
+
(exc (#t (begin cleanup
|
173
|
+
temp)))
|
174
|
+
(begin0
|
175
|
+
(set! temp body)
|
176
|
+
cleanup))))))
|
177
|
+
|
178
|
+
|