bel_parser 1.0.0.alpha.12 → 1.0.0.alpha.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gemspec +1 -1
- data/VERSION +1 -1
- data/bin/bel2_validator +35 -8
- data/lib/bel_parser/expression/validator.rb +3 -2
- data/lib/bel_parser/language/apply_namespace_encoding.rb +96 -0
- data/lib/bel_parser/language/base_specification.rb +82 -0
- data/lib/bel_parser/language/expression_validator.rb +6 -2
- data/lib/bel_parser/language/relationship.rb +1 -1
- data/lib/bel_parser/language/semantics/signature_mapping.rb +26 -32
- data/lib/bel_parser/language/semantics_ast.rb +285 -149
- data/lib/bel_parser/language/semantics_ast_warnings.rb +180 -0
- data/lib/bel_parser/language/semantics_result.rb +11 -2
- data/lib/bel_parser/language/semantics_type_warning.rb +22 -0
- data/lib/bel_parser/language/semantics_warning.rb +8 -0
- data/lib/bel_parser/language/specification.rb +38 -55
- data/lib/bel_parser/language/syntax/undefined_namespace_value.rb +43 -0
- data/lib/bel_parser/language/syntax_error.rb +8 -0
- data/lib/bel_parser/language/syntax_result.rb +8 -0
- data/lib/bel_parser/language/syntax_warning.rb +9 -4
- data/lib/bel_parser/language/version1_0/functions/abundance.rb +5 -6
- data/lib/bel_parser/language/version1_0/functions/biological_process.rb +5 -6
- data/lib/bel_parser/language/version1_0/functions/complex_abundance.rb +6 -7
- data/lib/bel_parser/language/version1_0/functions/fusion.rb +39 -60
- data/lib/bel_parser/language/version1_0/functions/gene_abundance.rb +9 -12
- data/lib/bel_parser/language/version1_0/functions/list.rb +5 -6
- data/lib/bel_parser/language/version1_0/functions/micro_rna_abundance.rb +5 -6
- data/lib/bel_parser/language/version1_0/functions/pathology.rb +5 -6
- data/lib/bel_parser/language/version1_0/functions/protein_abundance.rb +16 -30
- data/lib/bel_parser/language/version1_0/functions/protein_modification.rb +15 -27
- data/lib/bel_parser/language/version1_0/functions/rna_abundance.rb +8 -11
- data/lib/bel_parser/language/version1_0/functions/substitution.rb +6 -12
- data/lib/bel_parser/language/version1_0/functions/translocation.rb +9 -12
- data/lib/bel_parser/language/version1_0/functions/truncation.rb +2 -4
- data/lib/bel_parser/language/version1_0/value_encodings/abundance.rb +21 -0
- data/lib/bel_parser/language/version1_0/value_encodings/any.rb +74 -0
- data/lib/bel_parser/language/version1_0/value_encodings/biological_process.rb +21 -0
- data/lib/bel_parser/language/version1_0/value_encodings/complex_abundance.rb +21 -0
- data/lib/bel_parser/language/version1_0/value_encodings/gene_abundance.rb +21 -0
- data/lib/bel_parser/language/version1_0/value_encodings/micro_rna_abundance.rb +21 -0
- data/lib/bel_parser/language/version1_0/value_encodings/pathology.rb +21 -0
- data/lib/bel_parser/language/version1_0/value_encodings/protein_abundance.rb +21 -0
- data/lib/bel_parser/language/version1_0/value_encodings/rna_abundance.rb +21 -0
- data/lib/bel_parser/language/version1_0.rb +6 -87
- data/lib/bel_parser/language/version2_0/functions/abundance.rb +13 -18
- data/lib/bel_parser/language/version2_0/functions/biological_process.rb +5 -6
- data/lib/bel_parser/language/version2_0/functions/complex_abundance.rb +9 -12
- data/lib/bel_parser/language/version2_0/functions/fragment.rb +4 -9
- data/lib/bel_parser/language/version2_0/functions/from_location.rb +5 -6
- data/lib/bel_parser/language/version2_0/functions/fusion.rb +39 -66
- data/lib/bel_parser/language/version2_0/functions/gene_abundance.rb +13 -18
- data/lib/bel_parser/language/version2_0/functions/list.rb +5 -6
- data/lib/bel_parser/language/version2_0/functions/location.rb +5 -6
- data/lib/bel_parser/language/version2_0/functions/micro_rna_abundance.rb +13 -18
- data/lib/bel_parser/language/version2_0/functions/molecular_activity.rb +6 -5
- data/lib/bel_parser/language/version2_0/functions/pathology.rb +5 -6
- data/lib/bel_parser/language/version2_0/functions/protein_abundance.rb +21 -30
- data/lib/bel_parser/language/version2_0/functions/protein_modification.rb +11 -17
- data/lib/bel_parser/language/version2_0/functions/rna_abundance.rb +13 -18
- data/lib/bel_parser/language/version2_0/functions/to_location.rb +5 -6
- data/lib/bel_parser/language/version2_0/functions/variant.rb +1 -4
- data/lib/bel_parser/language/version2_0/value_encodings/abundance.rb +21 -0
- data/lib/bel_parser/language/version2_0/value_encodings/activity.rb +21 -0
- data/lib/bel_parser/language/version2_0/value_encodings/any.rb +74 -0
- data/lib/bel_parser/language/version2_0/value_encodings/biological_process.rb +21 -0
- data/lib/bel_parser/language/version2_0/value_encodings/complex_abundance.rb +21 -0
- data/lib/bel_parser/language/version2_0/value_encodings/gene_abundance.rb +21 -0
- data/lib/bel_parser/language/version2_0/value_encodings/location.rb +21 -0
- data/lib/bel_parser/language/version2_0/value_encodings/micro_rna_abundance.rb +21 -0
- data/lib/bel_parser/language/version2_0/value_encodings/pathology.rb +21 -0
- data/lib/bel_parser/language/version2_0/value_encodings/protein_abundance.rb +21 -0
- data/lib/bel_parser/language/version2_0/value_encodings/protein_modification.rb +21 -0
- data/lib/bel_parser/language/version2_0/value_encodings/rna_abundance.rb +21 -0
- data/lib/bel_parser/language/version2_0.rb +6 -60
- data/lib/bel_parser/language.rb +3 -4
- data/lib/bel_parser/parsers/ast/node.rb +14 -2
- data/lib/bel_parser/{language/quoting.rb → quoting.rb} +0 -56
- data/lib/bel_parser/resource/concept.rb +56 -0
- data/lib/bel_parser/resource/concept_scheme.rb +35 -0
- data/lib/bel_parser/resource/dataset.rb +34 -0
- data/lib/bel_parser/resource/eager_reader.rb +75 -0
- data/lib/bel_parser/resource/eager_sparql_reader.rb +51 -0
- data/lib/bel_parser/resource/http_cache.rb +71 -0
- data/lib/bel_parser/resource/jena_tdb_reader.rb +246 -0
- data/lib/bel_parser/resource/lru_cache.rb +111 -0
- data/lib/bel_parser/resource/lru_reader.rb +38 -0
- data/lib/bel_parser/resource/reader.rb +18 -0
- data/lib/bel_parser/resource/resource_file_reader.rb +134 -0
- data/lib/bel_parser/resource/sparql_reader.rb +178 -0
- data/lib/bel_parser/resource/value.rb +31 -0
- metadata +42 -4
- data/lib/bel_parser/language/version1_0/syntax/function.rb +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a431be1d3646bca92e1e4df5371f3d8bf8865c3f
|
4
|
+
data.tar.gz: ca8bd4846cbfb847efff3ba22840df28e2d222d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 621944ea9d667b47e61b017fdbdf05632355c25dc7d214ec5515ce872faee31ea84e2cf47147daf82c28a278be31c4116d2ce12b1ad87339fb6765621e979b12
|
7
|
+
data.tar.gz: a2102f77e4bc6419c7d28fdfea8c12005f08588c91b854b6a5b30d9987b70235af5ef0d00df8ec538af3423661e7d92e28c89304a7efee858591f272f5242f85
|
data/.gemspec
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.0.alpha.
|
1
|
+
1.0.0.alpha.13
|
data/bin/bel2_validator
CHANGED
@@ -11,17 +11,44 @@ unless ARGV.first
|
|
11
11
|
end
|
12
12
|
namespaces = Hash[ARGV[1..-1].map { |ns| ns.split('=') }]
|
13
13
|
|
14
|
+
def syntax_results(results)
|
15
|
+
results.select do |res|
|
16
|
+
res.is_a? BELParser::Language::Syntax::SyntaxResult
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def semantics_results(results)
|
21
|
+
results.select do |res|
|
22
|
+
res.is_a? BELParser::Language::Semantics::SemanticsResult
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
14
26
|
require 'bel_parser'
|
15
27
|
require 'bel_parser/expression/validator'
|
28
|
+
require 'bel_parser/resource/resource_file_reader'
|
29
|
+
|
30
|
+
resource_reader = BELParser::Resource::ResourceFileReader.new
|
16
31
|
BELParser::Expression::Validator
|
17
|
-
.new(ARGV.first, namespaces)
|
18
|
-
.each($stdin) do |(line_number, line, ast,
|
32
|
+
.new(ARGV.first, namespaces, resource_reader)
|
33
|
+
.each($stdin) do |(line_number, line, ast, results)|
|
19
34
|
puts "#{line_number}: #{line}"
|
20
35
|
puts " AST Type: #{ast.type}"
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
36
|
+
|
37
|
+
puts " Syntax results:"
|
38
|
+
syntax_results(results).each do |res|
|
39
|
+
puts " #{res}"
|
40
|
+
end
|
41
|
+
|
42
|
+
puts " Semantics results:"
|
43
|
+
semantics_results(results).each do |res|
|
44
|
+
if res.is_a?(BELParser::Language::Semantics::SignatureMappingSuccess)
|
45
|
+
puts " Matched signature: #{res.signature.string_form}"
|
46
|
+
end
|
47
|
+
if res.is_a?(BELParser::Language::Semantics::SignatureMappingWarning)
|
48
|
+
puts " Failed signature: #{res.signature.string_form}"
|
49
|
+
res.results.select(&:failure?).each do |warning|
|
50
|
+
puts " #{warning}"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
27
54
|
end
|
@@ -18,10 +18,10 @@ module BELParser
|
|
18
18
|
:simple_statement,
|
19
19
|
:nested_statement)
|
20
20
|
|
21
|
-
def initialize(specification_version, namespaces)
|
21
|
+
def initialize(specification_version, namespaces, resource_reader)
|
22
22
|
@spec = BELParser::Language.specification(specification_version)
|
23
23
|
@validator = BELParser::Language::ExpressionValidator.new(
|
24
|
-
@spec, namespaces)
|
24
|
+
@spec, namespaces, resource_reader)
|
25
25
|
end
|
26
26
|
|
27
27
|
def each(io)
|
@@ -52,6 +52,7 @@ if __FILE__ == $PROGRAM_NAME
|
|
52
52
|
BELParser::Expression::Validator
|
53
53
|
.new(ARGV.first, namespaces)
|
54
54
|
.each($stdin) do |(line_number, line, ast, messages)|
|
55
|
+
results.select { |res| res.is_a? BELParser::Language::Syntax::SyntaxError }
|
55
56
|
puts "#{line_number}: #{line}"
|
56
57
|
puts " AST Type: #{ast.type}"
|
57
58
|
puts messages
|
@@ -0,0 +1,96 @@
|
|
1
|
+
require 'bel_parser/quoting'
|
2
|
+
|
3
|
+
module BELParser
|
4
|
+
module Language
|
5
|
+
# ApplyNamespaceEncoding applies _namespace_ and _encoding_ properties to
|
6
|
+
# {BELParser::Parsers::AST::Parameter} child nodes.
|
7
|
+
class ApplyNamespaceEncoding
|
8
|
+
include AST::Processor::Mixin
|
9
|
+
include BELParser::Quoting
|
10
|
+
|
11
|
+
def initialize(language_spec, identifier_hash, resource_reader)
|
12
|
+
@language_spec = language_spec
|
13
|
+
@identifier_hash = identifier_hash
|
14
|
+
@resource_reader = resource_reader
|
15
|
+
end
|
16
|
+
|
17
|
+
def on_observed_term(observed_term_node)
|
18
|
+
process(observed_term_node.statement)
|
19
|
+
end
|
20
|
+
|
21
|
+
def on_simple_statement(simple_statement_node)
|
22
|
+
process(simple_statement_node.statement)
|
23
|
+
end
|
24
|
+
|
25
|
+
def on_nested_statement(nested_statement_node)
|
26
|
+
process(nested_statement_node.statement)
|
27
|
+
end
|
28
|
+
|
29
|
+
def on_statement(statement_node)
|
30
|
+
process(statement_node.subject)
|
31
|
+
process(statement_node.object) if statement_node.object?
|
32
|
+
end
|
33
|
+
|
34
|
+
def on_subject(subject_node)
|
35
|
+
process(subject_node.term)
|
36
|
+
end
|
37
|
+
|
38
|
+
def on_object(object_node)
|
39
|
+
process(object_node.child)
|
40
|
+
end
|
41
|
+
|
42
|
+
# Called when visiting nodes of type +term+.
|
43
|
+
def on_term(term_node)
|
44
|
+
term_node.arguments.each do |argument_node|
|
45
|
+
process(argument_node)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def on_argument(argument_node)
|
50
|
+
process(argument_node.child)
|
51
|
+
end
|
52
|
+
|
53
|
+
def on_parameter(parameter_node)
|
54
|
+
@resolved_dataset = nil
|
55
|
+
process(parameter_node.prefix)
|
56
|
+
process(parameter_node.value)
|
57
|
+
end
|
58
|
+
|
59
|
+
def on_prefix(prefix_node)
|
60
|
+
return prefix_node unless prefix_node.identifier
|
61
|
+
prefix = prefix_node.identifier.string_literal
|
62
|
+
|
63
|
+
identifier = @identifier_hash[prefix]
|
64
|
+
return prefix_node unless identifier
|
65
|
+
|
66
|
+
dataset = @resource_reader.retrieve_resource(identifier)
|
67
|
+
@resolved_dataset = dataset
|
68
|
+
prefix_node.namespace = dataset
|
69
|
+
|
70
|
+
prefix_node
|
71
|
+
end
|
72
|
+
|
73
|
+
def on_value(value_node)
|
74
|
+
return value_node unless @resolved_dataset
|
75
|
+
value_node.namespace = @resolved_dataset
|
76
|
+
identifier = @resolved_dataset.identifier
|
77
|
+
value_literal = unquote(value_node.children[0].string_literal)
|
78
|
+
|
79
|
+
value =
|
80
|
+
@resource_reader
|
81
|
+
.retrieve_value_from_resource(identifier, value_literal)
|
82
|
+
|
83
|
+
if value
|
84
|
+
value_node.encoding =
|
85
|
+
value
|
86
|
+
.encodings
|
87
|
+
.map(&@language_spec.method(:value_encoding))
|
88
|
+
value_node.namespace_value = value
|
89
|
+
else
|
90
|
+
value_node.encoding = nil
|
91
|
+
value_node.namespace_value = nil
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require_relative 'specification'
|
2
|
+
|
3
|
+
module BELParser
|
4
|
+
module Language
|
5
|
+
# BaseSpecification defines behaviour for loading BEL version files.
|
6
|
+
class BaseSpecification
|
7
|
+
include Specification
|
8
|
+
|
9
|
+
def self.load_version_path(version_path)
|
10
|
+
base_path = File.expand_path(File.dirname(__FILE__)) + File::SEPARATOR
|
11
|
+
['return_types', 'value_encodings', 'functions', 'relationships']
|
12
|
+
.each do |set|
|
13
|
+
Dir[File.join(base_path, version_path, set, '*.rb')]
|
14
|
+
.each do |ruby_file|
|
15
|
+
ruby_file.sub!(/^#{Regexp.escape(base_path)}/, '')
|
16
|
+
require_relative ruby_file
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
protected
|
22
|
+
|
23
|
+
def load_language_constants(version_module)
|
24
|
+
load_return_types(version_module)
|
25
|
+
load_value_encodings(version_module)
|
26
|
+
load_functions(version_module)
|
27
|
+
load_relationships(version_module)
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def load_return_types(version_module)
|
33
|
+
# Collect return types
|
34
|
+
ret_classes =
|
35
|
+
version_module::ReturnTypes.constants.collect do |symbol|
|
36
|
+
const = version_module::ReturnTypes.const_get(symbol)
|
37
|
+
const if const.respond_to?(:subtypes)
|
38
|
+
end
|
39
|
+
@return_types = ret_classes.compact
|
40
|
+
@indexed_return_types = index_sym(@return_types)
|
41
|
+
end
|
42
|
+
|
43
|
+
def load_value_encodings(version_module)
|
44
|
+
# Collect value encodings
|
45
|
+
enc_classes =
|
46
|
+
version_module::ValueEncodings.constants.collect do |symbol|
|
47
|
+
const = version_module::ValueEncodings.const_get(symbol)
|
48
|
+
const if const.respond_to?(:subtypes)
|
49
|
+
end
|
50
|
+
@value_encodings = enc_classes.compact
|
51
|
+
@indexed_value_encodings = index_sym(@value_encodings)
|
52
|
+
end
|
53
|
+
|
54
|
+
def load_functions(version_module)
|
55
|
+
# Collect functions
|
56
|
+
function_classes =
|
57
|
+
version_module::Functions.constants.collect do |symbol|
|
58
|
+
const = version_module::Functions.const_get(symbol)
|
59
|
+
const if
|
60
|
+
const.respond_to?(:short) &&
|
61
|
+
const.respond_to?(:long)
|
62
|
+
end
|
63
|
+
@functions = function_classes.compact
|
64
|
+
@indexed_functions = index_long_short(@functions)
|
65
|
+
end
|
66
|
+
|
67
|
+
def load_relationships(version_module)
|
68
|
+
# Collect relationships
|
69
|
+
rel_classes =
|
70
|
+
version_module::Relationships.constants.collect do |symbol|
|
71
|
+
const = version_module::Relationships.const_get(symbol)
|
72
|
+
const if
|
73
|
+
const.respond_to?(:short) &&
|
74
|
+
const.respond_to?(:long)
|
75
|
+
end
|
76
|
+
@relationships = rel_classes.compact
|
77
|
+
@indexed_relationships = index_long_short(@relationships)
|
78
|
+
assign_relationship_categories(@relationships)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require_relative 'syntax'
|
2
2
|
require_relative 'semantics'
|
3
|
+
require_relative 'apply_namespace_encoding'
|
3
4
|
|
4
5
|
module BELParser
|
5
6
|
module Language
|
@@ -7,11 +8,13 @@ module BELParser
|
|
7
8
|
# when supplied a {BELParser::Language::Specification} and Hash of
|
8
9
|
# namespaces.
|
9
10
|
class ExpressionValidator
|
10
|
-
def initialize(spec, namespaces)
|
11
|
+
def initialize(spec, namespaces, resource_reader)
|
11
12
|
@spec = spec
|
12
13
|
@namespaces = namespaces
|
13
14
|
@syntax_functions = Syntax.syntax_functions
|
14
15
|
@semantics_functions = Semantics.semantics_functions
|
16
|
+
@transform =
|
17
|
+
ApplyNamespaceEncoding.new(@spec, @namespaces, resource_reader)
|
15
18
|
end
|
16
19
|
|
17
20
|
# Validate the syntax and semantics of
|
@@ -20,6 +23,7 @@ module BELParser
|
|
20
23
|
# @param [BELParser::Parsers::AST::Node] expression_node to validate
|
21
24
|
# @return [BELParser::Language::Syntax::SyntaxResult] syntax results
|
22
25
|
def validate(expression_node)
|
26
|
+
@transform.process(expression_node)
|
23
27
|
results = syntax(expression_node)
|
24
28
|
if results.empty?
|
25
29
|
results << Syntax::Valid.new(expression_node, @spec)
|
@@ -38,7 +42,7 @@ module BELParser
|
|
38
42
|
|
39
43
|
def semantics(expression_node)
|
40
44
|
expression_node.traverse.flat_map do |node|
|
41
|
-
@semantics_functions.
|
45
|
+
@semantics_functions.flat_map { |func| func.map(node, @spec, @namespaces) }
|
42
46
|
end.compact
|
43
47
|
end
|
44
48
|
end
|
@@ -20,45 +20,41 @@ module BELParser
|
|
20
20
|
def self.map(term_node, spec, _namespaces)
|
21
21
|
return nil unless term_node.is_a?(BELParser::Parsers::AST::Term)
|
22
22
|
|
23
|
-
|
23
|
+
function_name = term_node.function.identifier.string_literal
|
24
|
+
function = spec.function(function_name.to_sym)
|
25
|
+
mapsig = method(:map_signature).to_proc.curry[term_node][spec]
|
24
26
|
|
25
|
-
|
26
|
-
SignatureMappingWarning.new(term_node, spec, failures)
|
27
|
-
else
|
28
|
-
SignatureMappingSuccess.new(term_node, spec, successes, failures)
|
29
|
-
end
|
27
|
+
function.signatures.map(&mapsig)
|
30
28
|
end
|
31
29
|
|
32
|
-
def self.
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
.
|
39
|
-
|
30
|
+
def self.map_signature(term_node, spec, signature)
|
31
|
+
results = BELParser::Language::Semantics.match(
|
32
|
+
term_node,
|
33
|
+
signature.semantic_ast,
|
34
|
+
spec)
|
35
|
+
if results.all?(&:success?)
|
36
|
+
SignatureMappingSuccess.new(term_node, spec, signature, results)
|
37
|
+
else
|
38
|
+
SignatureMappingWarning.new(term_node, spec, signature, results)
|
39
|
+
end
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
43
|
# SignatureMappingSuccess defines a {SemanticsResult} that indicates
|
44
44
|
# a successful signature match.
|
45
45
|
class SignatureMappingSuccess < SemanticsResult
|
46
|
-
attr_reader :
|
47
|
-
attr_reader :
|
46
|
+
attr_reader :signature
|
47
|
+
attr_reader :results
|
48
48
|
|
49
|
-
def initialize(term_node, spec,
|
49
|
+
def initialize(term_node, spec, signature, results)
|
50
50
|
super(term_node, spec)
|
51
|
-
@
|
52
|
-
@
|
51
|
+
@signature = signature
|
52
|
+
@results = results
|
53
53
|
end
|
54
54
|
|
55
55
|
def to_s
|
56
|
-
sig_list = success_signatures
|
57
|
-
.map { |(sig, _results)| sig.string_form }
|
58
|
-
.join("\n ")
|
59
56
|
<<-MSG.gsub(/ {12}/, '').gsub(/\n$/, '')
|
60
|
-
Term
|
61
|
-
#{sig_list}
|
57
|
+
Term matched function signature: #{@signature.string_form}
|
62
58
|
MSG
|
63
59
|
end
|
64
60
|
end
|
@@ -66,20 +62,18 @@ module BELParser
|
|
66
62
|
# SignatureMappingWarning defines a {SemanticsWarning} that indicates
|
67
63
|
# an unsuccessful signature match.
|
68
64
|
class SignatureMappingWarning < SemanticsWarning
|
69
|
-
attr_reader :
|
65
|
+
attr_reader :signature
|
66
|
+
attr_reader :results
|
70
67
|
|
71
|
-
def initialize(term_node, spec,
|
68
|
+
def initialize(term_node, spec, signature, results)
|
72
69
|
super(term_node, spec)
|
73
|
-
@
|
70
|
+
@signature = signature
|
71
|
+
@results = results
|
74
72
|
end
|
75
73
|
|
76
74
|
def to_s
|
77
|
-
sig_list = failure_signatures
|
78
|
-
.map { |(sig, _results)| sig.string_form }
|
79
|
-
.join("\n ")
|
80
75
|
<<-MSG.gsub(/ {12}/, '').gsub(/\n$/, '')
|
81
|
-
Term did not
|
82
|
-
#{sig_list}
|
76
|
+
Term did not match function signature: #{@signature.string_form}
|
83
77
|
MSG
|
84
78
|
end
|
85
79
|
end
|