nendo 0.6.0 → 0.6.1
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 +18 -0
- data/lib/init.nndc +3458 -3078
- data/lib/nendo/experimental.nnd +23 -2
- data/lib/nendo/experimental.nndc +2122 -276
- data/lib/nendo/test.nndc +116 -4
- data/lib/rfc/json.nndc +6 -6
- data/lib/ruby/core.rb +1 -1
- data/lib/ruby/printer.rb +6 -0
- data/lib/ruby/types.rb +4 -1
- 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.nndc +294 -294
- data/lib/util/match.nndc +5551 -5551
- data/test/nendo_spec.rb +33 -0
- data/test/syntax_spec.rb +31 -7
- metadata +5 -5
data/test/nendo_spec.rb
CHANGED
@@ -1230,6 +1230,8 @@ describe Nendo, "when use #xxxx syntax " do
|
|
1230
1230
|
@nendo.evalStr( " '#?." ).should == '"(string):1"'
|
1231
1231
|
@nendo.evalStr( " '#?." ).should == '"(string):1"'
|
1232
1232
|
@nendo.evalStr( " (begin #?. (+ 1 1))" ).should == "2"
|
1233
|
+
@nendo.evalStr( " (rxmatch #/[a-z]/ \"abc\")" ).should == "a"
|
1234
|
+
@nendo.evalStr( " (quote #?=(rxmatch #/[a-z]/ \"abc\"))" ).should == '(debug-print (rxmatch #/[a-z]/ "abc") "(string)" 1 (quote (rxmatch #/[a-z]/ "abc")))'
|
1233
1235
|
@nendo.evalStr( <<EOS
|
1234
1236
|
(begin
|
1235
1237
|
#?.
|
@@ -2130,6 +2132,37 @@ describe Nendo, "when use macros expand some syntax. " do
|
|
2130
2132
|
end
|
2131
2133
|
end
|
2132
2134
|
|
2135
|
+
describe Nendo, "when occur illegal syntax. " do
|
2136
|
+
before do
|
2137
|
+
@nendo = Nendo::Core.new()
|
2138
|
+
@nendo.loadInitFile
|
2139
|
+
end
|
2140
|
+
it "should" do
|
2141
|
+
|
2142
|
+
lambda { @nendo.evalStr( <<EOS
|
2143
|
+
(let abc 1 ;; let1 style form is illegal syntax for let form.
|
2144
|
+
(print abc))
|
2145
|
+
EOS
|
2146
|
+
) }.should raise_error( SyntaxError, /^named let requires/ )
|
2147
|
+
|
2148
|
+
lambda { @nendo.evalStr( "(let 1)" ) }.should raise_error( SyntaxError, /^let requires/ )
|
2149
|
+
lambda { @nendo.evalStr( "(let ())" ) }.should raise_error( SyntaxError, /^let requires/ )
|
2150
|
+
@nendo.evalStr( "(let () 1)" ).should == '1'
|
2151
|
+
lambda { @nendo.evalStr( "(let loop 1)" ) }.should raise_error( SyntaxError, /^named let requires/ )
|
2152
|
+
lambda { @nendo.evalStr( "(let loop ())" ) }.should raise_error( SyntaxError, /^named let requires/ )
|
2153
|
+
@nendo.evalStr( "(let loop () 1)" ).should == '1'
|
2154
|
+
|
2155
|
+
lambda { @nendo.evalStr( "(let1)" ) }.should raise_error( SyntaxError, /^let1 requires/ )
|
2156
|
+
lambda { @nendo.evalStr( "(let1 a)" ) }.should raise_error( SyntaxError, /^let1 requires/ )
|
2157
|
+
lambda { @nendo.evalStr( "(let1 a 1)" ) }.should raise_error( SyntaxError, /^let1 requires/ )
|
2158
|
+
lambda { @nendo.evalStr( "(let1 (a 1) (print a))" ) }.should raise_error( SyntaxError, /^let1 requires/ )
|
2159
|
+
lambda { @nendo.evalStr( "(let1 ((a 1)) (print a))" ) }.should raise_error( SyntaxError, /^let1 requires/ )
|
2160
|
+
@nendo.evalStr( "(let1 a 123 a)" ).should == '123'
|
2161
|
+
@nendo.evalStr( "(let1 b (+ 100 20 3) b)" ).should == '123'
|
2162
|
+
end
|
2163
|
+
end
|
2164
|
+
|
2165
|
+
|
2133
2166
|
describe Nendo, "when use dot-operator (.) macro " do
|
2134
2167
|
before do
|
2135
2168
|
@nendo = Nendo::Core.new()
|
data/test/syntax_spec.rb
CHANGED
@@ -751,7 +751,7 @@ EOS
|
|
751
751
|
(%guard-clause (exc
|
752
752
|
(else (print "ELSE"))))))
|
753
753
|
EOS
|
754
|
-
).should
|
754
|
+
).should match( /^[(]cond.+else.+print.+ELSE.+[(]#t [(]raise.+exc[)][)][)]$/ )
|
755
755
|
|
756
756
|
|
757
757
|
@nendo.evalStr( <<EOS
|
@@ -762,7 +762,23 @@ EOS
|
|
762
762
|
(print "<<RuntimeError>>"))
|
763
763
|
(else (print "ELSE"))))))
|
764
764
|
EOS
|
765
|
-
).should
|
765
|
+
).should match( /^[(]cond.+exc.is_a.+RuntimeError.+<<RuntimeError>>.+else.+print.+ELSE.+[(]#t [(]raise.+exc[)][)][)]$/ )
|
766
|
+
|
767
|
+
@nendo.evalStr( <<EOS
|
768
|
+
(macroexpand-1
|
769
|
+
(quote
|
770
|
+
(%guard-clause (exc
|
771
|
+
((exc.is_a? RuntimeError)
|
772
|
+
(print "<<RuntimeError>>"))))))
|
773
|
+
EOS
|
774
|
+
).should match( /^[(]cond.+exc.is_a.+RuntimeError.+<<RuntimeError>>.+[(]#t [(]raise.+exc[)][)][)]$/ )
|
775
|
+
|
776
|
+
@nendo.evalStr( <<EOS
|
777
|
+
(macroexpand-1
|
778
|
+
(quote
|
779
|
+
(%guard-clause (exc))))
|
780
|
+
EOS
|
781
|
+
).should match( /^[(]cond.+[(]#t [(]raise.+exc[)][)][)]$/ )
|
766
782
|
|
767
783
|
@nendo.evalStr( <<EOS
|
768
784
|
(macroexpand-1
|
@@ -772,9 +788,10 @@ EOS
|
|
772
788
|
(print "<<RuntimeError>>"))
|
773
789
|
(else
|
774
790
|
=> (lambda (e)
|
775
|
-
(
|
791
|
+
(sprintf "Type is [%s]" e.class)))))))
|
776
792
|
EOS
|
777
|
-
).should
|
793
|
+
).should match( /^[(]cond.+exc.is_a.+RuntimeError.+print.+RuntimeError.+else.+feedto.+[(]#t [(]raise exc[)][)][)]$/ )
|
794
|
+
|
778
795
|
|
779
796
|
end
|
780
797
|
end
|
@@ -783,6 +800,7 @@ end
|
|
783
800
|
describe Nendo, "When use guard special form" do
|
784
801
|
before do
|
785
802
|
@nendo = Nendo::Core.new()
|
803
|
+
@nendo.setDisplayErrors( false )
|
786
804
|
@nendo.loadInitFile
|
787
805
|
end
|
788
806
|
it "should" do
|
@@ -858,7 +876,14 @@ EOS
|
|
858
876
|
EOS
|
859
877
|
).should == '"Type is [RuntimeError]"'
|
860
878
|
|
861
|
-
@nendo.evalStr( <<EOS
|
879
|
+
lambda { @nendo.evalStr( <<EOS
|
880
|
+
(guard
|
881
|
+
(exc)
|
882
|
+
(error "This is RuntimeError"))
|
883
|
+
EOS
|
884
|
+
) }.should raise_error( RuntimeError )
|
885
|
+
|
886
|
+
lambda { @nendo.evalStr( <<EOS
|
862
887
|
(begin
|
863
888
|
(guard
|
864
889
|
(exc ((exc.is_a? RuntimeError)
|
@@ -866,7 +891,7 @@ EOS
|
|
866
891
|
(+ (Array.new) 1))
|
867
892
|
\"-END-\")
|
868
893
|
EOS
|
869
|
-
).should
|
894
|
+
) }.should raise_error( TypeError )
|
870
895
|
|
871
896
|
end
|
872
897
|
end
|
@@ -1032,4 +1057,3 @@ EOS
|
|
1032
1057
|
|
1033
1058
|
end
|
1034
1059
|
end
|
1035
|
-
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nendo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 5
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 1
|
10
|
+
version: 0.6.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Kiyoka Nishiyama
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-11-05 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rspec
|
@@ -209,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
209
209
|
requirements: []
|
210
210
|
|
211
211
|
rubyforge_project:
|
212
|
-
rubygems_version: 1.8.
|
212
|
+
rubygems_version: 1.8.11
|
213
213
|
signing_key:
|
214
214
|
specification_version: 3
|
215
215
|
summary: Nendo is a dialect of Lisp.
|