skeem 0.0.17 → 0.0.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/lib/skeem/grammar.rb +7 -7
- data/lib/skeem/interpreter.rb +10 -6
- data/lib/skeem/primitive/primitive_builder.rb +205 -131
- data/lib/skeem/primitive/primitive_procedure.rb +111 -0
- data/lib/skeem/s_expr_builder.rb +31 -11
- data/lib/skeem/s_expr_nodes.rb +134 -23
- data/lib/skeem/standard/base.skm +9 -1
- data/lib/skeem/tokenizer.rb +10 -4
- data/lib/skeem/version.rb +1 -1
- data/spec/skeem/interpreter_spec.rb +81 -255
- data/spec/skeem/primitive/primitive_builder_spec.rb +251 -10
- data/spec/skeem/primitive/primitive_procedure_spec.rb +162 -0
- data/spec/skeem/s_expr_nodes_spec.rb +3 -0
- data/spec/skeem/tokenizer_spec.rb +1 -0
- metadata +5 -3
- data/lib/skeem/primitive_procedure.rb +0 -19
@@ -1,19 +0,0 @@
|
|
1
|
-
require_relative 's_expr_nodes'
|
2
|
-
|
3
|
-
module Skeem
|
4
|
-
class PrimitiveProcedure
|
5
|
-
attr_reader(:identifier)
|
6
|
-
attr_reader(:code)
|
7
|
-
|
8
|
-
def initialize(anId, aRubyLambda)
|
9
|
-
@identifier = anId.kind_of?(String) ? SkmIdentifier.create(anId) : anId
|
10
|
-
@code = aRubyLambda
|
11
|
-
end
|
12
|
-
|
13
|
-
# Arguments are positional in a primitive procedure.
|
14
|
-
def call(aRuntime, aProcedureCall)
|
15
|
-
args = aProcedureCall.operands
|
16
|
-
return @code.call(aRuntime, args)
|
17
|
-
end
|
18
|
-
end # class
|
19
|
-
end # module
|