klam 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/HISTORY.asciidoc +18 -0
- data/lib/klam/compilation_stages/emit_ruby.rb +1 -18
- data/lib/klam/environment.rb +3 -0
- data/lib/klam/primitives/error_handling.rb +5 -1
- data/lib/klam/primitives/generic_functions.rb +2 -0
- data/lib/klam/version.rb +1 -1
- data/spec/unit/klam/primitives/error_handling_spec.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc3dcaef0efecdb916e9c2907f08db38c0ea5a5e
|
4
|
+
data.tar.gz: a5751310c733519a4815040f0005fff1f36196b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41d80904122f50bbd3b1d7c1586e5666e44f38135d680ae5ca81844df4ca100c693bdc9f031eaf6b698f76881fe5f2db916b80a9d340981839481d23ff725802
|
7
|
+
data.tar.gz: 9635963254c84641c58e9d69f3bb4a803fd7e1702a0b7360b7b3a397ac940ffa04a3674f248be4d1224a8f964336420fe0da1590e1276e75f07fd4ea44b8209f
|
data/HISTORY.asciidoc
CHANGED
@@ -1,6 +1,24 @@
|
|
1
1
|
Relase History
|
2
2
|
==============
|
3
3
|
|
4
|
+
v0.0.7 -- February 24, 2015
|
5
|
+
---------------------------
|
6
|
+
New Features
|
7
|
+
~~~~~~~~~~~~
|
8
|
+
* Debugging output enabled by global flags:
|
9
|
+
** `*dump-kl*` causes the KLambda code received by the compiler to be dumped
|
10
|
+
to stdout.
|
11
|
+
** `*dump-rb*` causes the Ruby code generated by the compiler to be dumped
|
12
|
+
to stdout.
|
13
|
+
** `*include-backtrace-in-error-string*` causes the backtrace from the error
|
14
|
+
object to be appended to the string returned by error-to-string.
|
15
|
+
|
16
|
+
Bug Fixes
|
17
|
+
~~~~~~~~~
|
18
|
+
* Carriage return and new line are now properly escaped in emitted Ruby code. This
|
19
|
+
fixes "warning: encountered \r in middle of line, treated as a mere space" messages
|
20
|
+
that show up, e.g., when using a unit string like "c#13;" in Shen.
|
21
|
+
|
4
22
|
v0.0.6 -- February 1, 2015
|
5
23
|
--------------------------
|
6
24
|
Breaking Changes
|
@@ -193,7 +193,7 @@ module Klam
|
|
193
193
|
end
|
194
194
|
|
195
195
|
def emit_string(str)
|
196
|
-
|
196
|
+
str.inspect
|
197
197
|
end
|
198
198
|
|
199
199
|
def emit_symbol(sym)
|
@@ -211,23 +211,6 @@ module Klam
|
|
211
211
|
render_string('(begin; $2; rescue => $1; $3; end)', err_var_rb,
|
212
212
|
expr_rb, apply_handler_rb)
|
213
213
|
end
|
214
|
-
|
215
|
-
# Escape single quotes and backslashes
|
216
|
-
def escape_string(str)
|
217
|
-
new_str = ""
|
218
|
-
str.each_char do |c|
|
219
|
-
if c == "'"
|
220
|
-
new_str << "\\"
|
221
|
-
new_str << "'"
|
222
|
-
elsif c == '\\'
|
223
|
-
new_str << '\\'
|
224
|
-
new_str << '\\'
|
225
|
-
else
|
226
|
-
new_str << c
|
227
|
-
end
|
228
|
-
end
|
229
|
-
new_str
|
230
|
-
end
|
231
214
|
end
|
232
215
|
end
|
233
216
|
end
|
data/lib/klam/environment.rb
CHANGED
@@ -34,6 +34,9 @@ module Klam
|
|
34
34
|
|
35
35
|
# The open primitive depends on having *home-directory* assigned.
|
36
36
|
set(:"*home-directory*", ::Dir.pwd)
|
37
|
+
set(:"*dump-kl*", false)
|
38
|
+
set(:"*dump-rb*", false)
|
39
|
+
set(:"*include-backtrace-in-error-string*", false)
|
37
40
|
end
|
38
41
|
|
39
42
|
def __apply(rator, *rands)
|
@@ -10,7 +10,11 @@ module Klam
|
|
10
10
|
# trap-error is a special form and implemented in the compiler
|
11
11
|
|
12
12
|
def error_to_string(err)
|
13
|
-
|
13
|
+
if value(:"*include-backtrace-in-error-string*")
|
14
|
+
([err.message] + err.backtrace).join("\n")
|
15
|
+
else
|
16
|
+
err.message
|
17
|
+
end
|
14
18
|
end
|
15
19
|
alias_method :"error-to-string", :error_to_string
|
16
20
|
remove_method :error_to_string
|
data/lib/klam/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: klam
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg Spurrier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|