nendo 0.5.3 → 0.5.4
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.
- 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.rb
CHANGED
@@ -82,6 +82,7 @@ module Nendo
|
|
82
82
|
attr_reader :syntaxName
|
83
83
|
end
|
84
84
|
|
85
|
+
|
85
86
|
class Cell
|
86
87
|
include Enumerable
|
87
88
|
|
@@ -215,6 +216,17 @@ module Nendo
|
|
215
216
|
attr_reader :key
|
216
217
|
end
|
217
218
|
|
219
|
+
class NendoTestError
|
220
|
+
def initialize( type = RuntimeError )
|
221
|
+
@type = type
|
222
|
+
end
|
223
|
+
|
224
|
+
def to_s
|
225
|
+
type.to_s
|
226
|
+
end
|
227
|
+
attr_accessor :type
|
228
|
+
end
|
229
|
+
|
218
230
|
class SyntacticClosure
|
219
231
|
def initialize( originalSymbol, renamedSymbol )
|
220
232
|
@originalSymbol = originalSymbol
|
@@ -1298,7 +1310,7 @@ module Nendo
|
|
1298
1310
|
end
|
1299
1311
|
|
1300
1312
|
# backtrace expects this format "filename:lineno: place message ". e.g. "init.nnd:10: in aaa macro.".
|
1301
|
-
def
|
1313
|
+
def __PAMARKraise( exception, message, backtrace )
|
1302
1314
|
raise exception, message, [ backtrace ]
|
1303
1315
|
end
|
1304
1316
|
|
@@ -1366,7 +1378,7 @@ module Nendo
|
|
1366
1378
|
}
|
1367
1379
|
@char_table_ruby_to_lisp = @char_table_lisp_to_ruby.invert
|
1368
1380
|
|
1369
|
-
@core_syntax_list = [ :quote, :"syntax-quote", :if , :begin , :lambda , :macro , :"&block" , :"%let" , :letrec , :define, :set!, :error, :"%syntax", :"define-syntax", :"let-syntax" ]
|
1381
|
+
@core_syntax_list = [ :quote, :"syntax-quote", :if , :begin , :lambda , :macro , :"&block" , :"%let" , :letrec , :define, :set!, :error, :"%syntax", :"define-syntax", :"let-syntax", :"%guard" ]
|
1370
1382
|
@core_syntax_hash = Hash.new
|
1371
1383
|
@core_syntax_list.each { |x|
|
1372
1384
|
renamed = ("/nendo/core/" + x.to_s).intern
|
@@ -1897,6 +1909,18 @@ module Nendo
|
|
1897
1909
|
"end"]
|
1898
1910
|
end
|
1899
1911
|
|
1912
|
+
def makeGuard( args, locals )
|
1913
|
+
_var = toRubySymbol( args.car )
|
1914
|
+
_locals = locals.clone + [_var]
|
1915
|
+
_case = translate( args.cdr.car, _locals )
|
1916
|
+
_thunk = translate( args.cdr.cdr.car, _locals )
|
1917
|
+
["begin",
|
1918
|
+
[ _thunk ],
|
1919
|
+
"rescue => " + _var,
|
1920
|
+
[ _case ],
|
1921
|
+
"end" ]
|
1922
|
+
end
|
1923
|
+
|
1900
1924
|
def apply( car, cdr, sourcefile, lineno, locals, sourceInfo, execType )
|
1901
1925
|
cdr.each { |x|
|
1902
1926
|
if Cell == x.class
|
@@ -2022,6 +2046,8 @@ module Nendo
|
|
2022
2046
|
self.makeLet( sexp.cdr, locals )
|
2023
2047
|
elsif :letrec == car
|
2024
2048
|
self.makeLetrec( sexp.cdr, locals )
|
2049
|
+
elsif :"%guard" == car
|
2050
|
+
self.makeGuard( sexp.cdr, locals )
|
2025
2051
|
elsif :"%tailcall" == car
|
2026
2052
|
if sexp.cdr.car.is_a? Cell
|
2027
2053
|
sexp = sexp.cdr.car
|
@@ -2704,7 +2730,7 @@ module Nendo
|
|
2704
2730
|
end
|
2705
2731
|
|
2706
2732
|
def self.version
|
2707
|
-
"0.5.
|
2733
|
+
"0.5.4" ##NENDO-VERSION
|
2708
2734
|
end
|
2709
2735
|
|
2710
2736
|
attr_reader :evaluator
|
data/lib/rfc/json.nndc
CHANGED
@@ -553,13 +553,13 @@ trampCall(
|
|
553
553
|
end
|
554
554
|
} ; ___lambda.call(
|
555
555
|
begin
|
556
|
-
___lambda = lambda { |
|
556
|
+
___lambda = lambda { |___gensym__6e1da08b054bbf0469585c6330e1b00b59b91d4c_90123|
|
557
557
|
if (
|
558
558
|
begin
|
559
559
|
embedBacktraceInfo( "./lib/rfc/json.nnd", 62 );
|
560
560
|
_null_QUMARK(
|
561
561
|
begin
|
562
|
-
trampCall(
|
562
|
+
trampCall(___gensym__6e1da08b054bbf0469585c6330e1b00b59b91d4c_90123)
|
563
563
|
rescue => __e ; __e.set_backtrace( [":1"] + __e.backtrace ) ; raise __e
|
564
564
|
end
|
565
565
|
)
|
@@ -581,7 +581,7 @@ trampCall(
|
|
581
581
|
end ,
|
582
582
|
[
|
583
583
|
begin
|
584
|
-
trampCall(
|
584
|
+
trampCall(___gensym__6e1da08b054bbf0469585c6330e1b00b59b91d4c_90123)
|
585
585
|
rescue => __e ; __e.set_backtrace( [":1"] + __e.backtrace ) ; raise __e
|
586
586
|
end
|
587
587
|
]
|
@@ -671,13 +671,13 @@ trampCall(
|
|
671
671
|
end
|
672
672
|
} ; ___lambda.call(
|
673
673
|
begin
|
674
|
-
___lambda = lambda { |
|
674
|
+
___lambda = lambda { |___gensym__6e1da08b054bbf0469585c6330e1b00b59b91d4c_90124|
|
675
675
|
if (
|
676
676
|
begin
|
677
677
|
embedBacktraceInfo( "./lib/rfc/json.nnd", 62 );
|
678
678
|
_null_QUMARK(
|
679
679
|
begin
|
680
|
-
trampCall(
|
680
|
+
trampCall(___gensym__6e1da08b054bbf0469585c6330e1b00b59b91d4c_90124)
|
681
681
|
rescue => __e ; __e.set_backtrace( [":1"] + __e.backtrace ) ; raise __e
|
682
682
|
end
|
683
683
|
)
|
@@ -699,7 +699,7 @@ trampCall(
|
|
699
699
|
end ,
|
700
700
|
[
|
701
701
|
begin
|
702
|
-
trampCall(
|
702
|
+
trampCall(___gensym__6e1da08b054bbf0469585c6330e1b00b59b91d4c_90124)
|
703
703
|
rescue => __e ; __e.set_backtrace( [":1"] + __e.backtrace ) ; raise __e
|
704
704
|
end
|
705
705
|
]
|