crisp 0.0.5 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +10 -2
- data/README.md +2 -1
- data/Rakefile +2 -2
- data/autotest/discover.rb +1 -0
- data/crisp.gemspec +32 -8
- data/examples/fibonacci.crisp +6 -0
- data/lib/crisp.rb +3 -1
- data/lib/crisp/chained_env.rb +13 -0
- data/lib/crisp/crisp.treetop +23 -15
- data/lib/crisp/env.rb +7 -0
- data/lib/crisp/function.rb +6 -42
- data/lib/crisp/function_runner.rb +37 -0
- data/lib/crisp/functions.rb +5 -3
- data/lib/crisp/functions/arithmetic.rb +64 -9
- data/lib/crisp/functions/core.rb +80 -18
- data/lib/crisp/native_call_invoker.rb +16 -0
- data/lib/crisp/nodes.rb +30 -59
- data/lib/crisp/nodes/array_literal.rb +21 -0
- data/lib/crisp/nodes/base.rb +22 -0
- data/lib/crisp/nodes/block.rb +22 -0
- data/lib/crisp/nodes/false_literal.rb +11 -0
- data/lib/crisp/nodes/float_literal.rb +11 -0
- data/lib/crisp/nodes/integer_literal.rb +11 -0
- data/lib/crisp/nodes/nil_literal.rb +11 -0
- data/lib/crisp/nodes/operation.rb +20 -0
- data/lib/crisp/nodes/primitive.rb +16 -0
- data/lib/crisp/nodes/string_literal.rb +11 -0
- data/lib/crisp/nodes/symbol_literal.rb +15 -0
- data/lib/crisp/nodes/true_literal.rb +11 -0
- data/lib/crisp/parser.rb +7 -0
- data/lib/crisp/runtime.rb +7 -0
- data/lib/crisp/shell.rb +4 -0
- data/spec/crisp/arithmetics_spec.rb +39 -11
- data/spec/crisp/basic_spec.rb +7 -72
- data/spec/crisp/core_spec.rb +83 -0
- data/spec/crisp/function_spec.rb +49 -0
- data/spec/crisp/internal_spec.rb +60 -0
- data/spec/crisp/native_call_invoker_spec.rb +23 -0
- data/spec/crisp/string_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -0
- metadata +34 -10
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "NativeCallInvoker functionality" do
|
4
|
+
include Crisp::SpecHelper
|
5
|
+
|
6
|
+
it "should execute String#reverse probably" do
|
7
|
+
evaluate('(. reverse "foobar")').should == 'raboof'
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should execute Array#first probably" do
|
11
|
+
evaluate('(. first [1 2 3])').should == 1
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should execute Array#first(n) probably" do
|
15
|
+
evaluate('(. first [1 2 3] 2)').should == [1,2]
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should raise a named exception on invalid method" do
|
19
|
+
lambda do
|
20
|
+
evaluate('(. foo "bar")')
|
21
|
+
end.should raise_error(NoMethodError, %q{undefined method `foo' for "bar":String})
|
22
|
+
end
|
23
|
+
end
|
data/spec/crisp/string_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crisp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 7
|
10
|
+
version: 0.0.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Markus Gerdes
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-12-17 00:00:00 +01:00
|
19
19
|
default_executable: crisp
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -26,12 +26,12 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
29
|
+
hash: 21
|
30
30
|
segments:
|
31
31
|
- 1
|
32
32
|
- 4
|
33
|
-
-
|
34
|
-
version: 1.4.
|
33
|
+
- 9
|
34
|
+
version: 1.4.9
|
35
35
|
type: :runtime
|
36
36
|
version_requirements: *id001
|
37
37
|
- !ruby/object:Gem::Dependency
|
@@ -42,12 +42,12 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
hash:
|
45
|
+
hash: 3
|
46
46
|
segments:
|
47
47
|
- 2
|
48
|
-
-
|
48
|
+
- 3
|
49
49
|
- 0
|
50
|
-
version: 2.
|
50
|
+
version: 2.3.0
|
51
51
|
type: :development
|
52
52
|
version_requirements: *id002
|
53
53
|
description:
|
@@ -64,23 +64,43 @@ files:
|
|
64
64
|
- LICENSE
|
65
65
|
- README.md
|
66
66
|
- Rakefile
|
67
|
+
- autotest/discover.rb
|
67
68
|
- bin/crisp
|
68
69
|
- crisp.gemspec
|
70
|
+
- examples/fibonacci.crisp
|
69
71
|
- lib/crisp.rb
|
70
72
|
- lib/crisp/chained_env.rb
|
71
73
|
- lib/crisp/crisp.treetop
|
72
74
|
- lib/crisp/env.rb
|
73
75
|
- lib/crisp/errors.rb
|
74
76
|
- lib/crisp/function.rb
|
77
|
+
- lib/crisp/function_runner.rb
|
75
78
|
- lib/crisp/functions.rb
|
76
79
|
- lib/crisp/functions/arithmetic.rb
|
77
80
|
- lib/crisp/functions/core.rb
|
81
|
+
- lib/crisp/native_call_invoker.rb
|
78
82
|
- lib/crisp/nodes.rb
|
83
|
+
- lib/crisp/nodes/array_literal.rb
|
84
|
+
- lib/crisp/nodes/base.rb
|
85
|
+
- lib/crisp/nodes/block.rb
|
86
|
+
- lib/crisp/nodes/false_literal.rb
|
87
|
+
- lib/crisp/nodes/float_literal.rb
|
88
|
+
- lib/crisp/nodes/integer_literal.rb
|
89
|
+
- lib/crisp/nodes/nil_literal.rb
|
90
|
+
- lib/crisp/nodes/operation.rb
|
91
|
+
- lib/crisp/nodes/primitive.rb
|
92
|
+
- lib/crisp/nodes/string_literal.rb
|
93
|
+
- lib/crisp/nodes/symbol_literal.rb
|
94
|
+
- lib/crisp/nodes/true_literal.rb
|
79
95
|
- lib/crisp/parser.rb
|
80
96
|
- lib/crisp/runtime.rb
|
81
97
|
- lib/crisp/shell.rb
|
82
98
|
- spec/crisp/arithmetics_spec.rb
|
83
99
|
- spec/crisp/basic_spec.rb
|
100
|
+
- spec/crisp/core_spec.rb
|
101
|
+
- spec/crisp/function_spec.rb
|
102
|
+
- spec/crisp/internal_spec.rb
|
103
|
+
- spec/crisp/native_call_invoker_spec.rb
|
84
104
|
- spec/crisp/string_spec.rb
|
85
105
|
- spec/spec_helper.rb
|
86
106
|
has_rdoc: true
|
@@ -120,5 +140,9 @@ summary: a tiny lisp-like language written in ruby using treetop.
|
|
120
140
|
test_files:
|
121
141
|
- spec/crisp/arithmetics_spec.rb
|
122
142
|
- spec/crisp/basic_spec.rb
|
143
|
+
- spec/crisp/core_spec.rb
|
144
|
+
- spec/crisp/function_spec.rb
|
145
|
+
- spec/crisp/internal_spec.rb
|
146
|
+
- spec/crisp/native_call_invoker_spec.rb
|
123
147
|
- spec/crisp/string_spec.rb
|
124
148
|
- spec/spec_helper.rb
|